Skip to content

Commit

Permalink
Creato CommonUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
asioleLab committed Nov 14, 2023
1 parent 43c035d commit 846d8d6
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package it.gov.pagopa.atmlayer.service.model.utils;

import org.apache.commons.io.FilenameUtils;

public class CommonUtils {

public static String getPathWithoutFilename(String path) {
return path.substring(0, path.length() - 1);
}

public static String getFilenameWithExtension(String fileName, String extension){
return fileName.concat(".").concat(extension);
}

public static String getFilenameWithExtensionFromStorageKey(String storageKey){
String fileName = FilenameUtils.getBaseName(storageKey);
String extension = FilenameUtils.getExtension(storageKey);
return getFilenameWithExtension(fileName,extension);
}
}

0 comments on commit 846d8d6

Please sign in to comment.