public final class FileName extends Object
Provides utility methods for manipulating file names.
Modifier and Type | Field and Description |
---|---|
static String |
DataStreamName |
static char |
DOS_SEPERATOR |
static String |
DOS_SEPERATOR_STR |
static String |
MainDataStreamName |
static String |
NTFSStreamSeperator |
Constructor and Description |
---|
FileName() |
Modifier and Type | Method and Description |
---|---|
static String |
buildPath(String dev,
String path,
String filename,
char sep)
Build a path using the specified components.
|
static boolean |
containsStreamName(String path)
Test if a file name contains an NTFS stream name
|
static String |
convertSeperators(String path,
char sep)
Convert the file seperators in a path to the specified path seperator character.
|
static String |
getParentPathForStream(String streamPath)
Get the path to the parent file of an NTFS stream
|
static String |
makeRelativePath(String basePath,
String fullPath)
Make a path relative to the base path for the specified path.
|
static String |
mapPath(String base,
String path)
Map the input path to a real path, this may require changing the case of various parts of the
path.
|
static String |
normalizePath(String path)
Normalize the path to uppercase the directory names and keep the case of the file name.
|
static String |
removeFileName(String path)
Remove the file name from the specified path string.
|
static String[] |
splitAllPaths(String path)
Split the path into all the component directories and filename
|
static String[] |
splitPath(String path)
Split the path into seperate directory path and file name strings.
|
static String[] |
splitPath(String path,
char sep)
Split the path into seperate directory path and file name strings.
|
static String[] |
splitPath(String path,
char sep,
String[] list)
Split the path into seperate directory path and file name strings.
|
static String[] |
splitPathStream(String path)
Split a path string into directory path, file name and stream name components
|
public static final char DOS_SEPERATOR
public static final String DOS_SEPERATOR_STR
public static final String NTFSStreamSeperator
public static final String MainDataStreamName
public static final String DataStreamName
public static String buildPath(String dev, String path, String filename, char sep)
dev
- java.lang.Stringpath
- java.lang.Stringfilename
- java.lang.Stringsep
- charpublic static String convertSeperators(String path, char sep)
path
- java.lang.Stringsep
- charpublic static final String mapPath(String base, String path) throws FileNotFoundException
base
- java.lang.Stringpath
- java.lang.StringFileNotFoundException
- The path could not be mapped to a real path.public static final String removeFileName(String path)
path
- java.lang.Stringpublic static String[] splitPath(String path)
path
- Full path string.public static String[] splitPath(String path, char sep)
path
- Full path string.sep
- Path seperator character.public static String[] splitPath(String path, char sep, String[] list)
path
- Full path string.sep
- Path seperator character.list
- String list to return values in, or null to allocatepublic static String[] splitAllPaths(String path)
path
- Stringpublic static String[] splitPathStream(String path)
path
- Full path string.public static boolean containsStreamName(String path)
path
- Stringpublic static final String normalizePath(String path)
path
- Stringpublic static final String makeRelativePath(String basePath, String fullPath)
basePath
- StringfullPath
- StringCopyright © 2005–2018 Alfresco Software. All rights reserved.