Package org.apache.tika.io
Class FilenameUtils
java.lang.Object
org.apache.tika.io.FilenameUtils
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final char[]Reserved characters
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringThis is a duplication of the algorithm and functionality available in commons io FilenameUtils.static StringgetSuffixFromPath(String path) This includes the period, e.g.static StringScans the given file name for reserved characters on different OSs and file systems and returns a sanitized version of the name with the reserved chars replaced by their hexadecimal value.
- 
Field Details- 
RESERVED_FILENAME_CHARACTERSpublic static final char[] RESERVED_FILENAME_CHARACTERSReserved characters
 
- 
- 
Constructor Details- 
FilenameUtilspublic FilenameUtils()
 
- 
- 
Method Details- 
normalizeScans the given file name for reserved characters on different OSs and file systems and returns a sanitized version of the name with the reserved chars replaced by their hexadecimal value.For example why?.zipwill be converted intowhy%3F.zip- Parameters:
- name- the file name to be normalized - NOT NULL
- Returns:
- the normalized file name
- Throws:
- IllegalArgumentException- if name is null
 
- 
getNameThis is a duplication of the algorithm and functionality available in commons io FilenameUtils. If Java's File were able handle Windows file paths correctly in linux, we wouldn't need this.The goal of this is to get a filename from a path. The package parsers and some other embedded doc extractors could put anything into TikaCoreProperties.RESOURCE_NAME_KEY. If a careless client used that filename as if it were a filename and not a path when writing embedded files, bad things could happen. Consider: "../../../my_ppt.ppt". Consider using this in combination with normalize(String).- Parameters:
- path- path to strip
- Returns:
- empty string or a filename, never null
 
- 
getSuffixFromPathThis includes the period, e.g. ".pdf"- Parameters:
- path-
- Returns:
- the suffix or an empty string if one could not be found
 
 
-