Package org.aksw.commons.util.string
Class FileNameUtils
- java.lang.Object
-
- org.aksw.commons.util.string.FileNameUtils
-
public class FileNameUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description FileNameUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringconstruct(Iterable<String> parts)Join strings with dot ('.') to form a filename; discards parts that are empty strings (causes consecutive dots to collapse into a single dot)static List<String>deconstruct(String filename)Decompose a filename into parts by splitting by dot ('.')static FileNamederiveFileName(String filename, EntityInfo entityInfo)Removes all encoding parts from the filename; optionally also removes the content type part.
-
-
-
Method Detail
-
deconstruct
public static List<String> deconstruct(String filename)
Decompose a filename into parts by splitting by dot ('.')
-
construct
public static String construct(Iterable<String> parts)
Join strings with dot ('.') to form a filename; discards parts that are empty strings (causes consecutive dots to collapse into a single dot)
-
deriveFileName
public static FileName deriveFileName(String filename, EntityInfo entityInfo)
Removes all encoding parts from the filename; optionally also removes the content type part. Given a file name and its detected encodings and content type, assume that the base name can be obtained by removing that many trailing file extensions. For example, if for the file foo.bar.tar.gz the content type tar and encoding gz were recognized then 2 trailing parts will be removed and the base name becomes foo.bar. At present the removal does not check whether the trailing parts actually correspond to the detected encodings / content type - so if foo.bar.x.y is also probed to a gzipped tar then the base name is also foo.bar.- Parameters:
filename-entityInfo-- Returns:
-
-