public enum FileSystem extends Enum<FileSystem>
toLegalFileName(String, char)
.
The starting point of any operation is getCurrent()
which gets you the enum for the file system that matches
the OS hosting the running JVM.
Enum Constant and Description |
---|
GENERIC
Generic file system.
|
LINUX
Linux file system.
|
MAC_OSX
MacOS file system.
|
WINDOWS
Windows file system.
|
Modifier and Type | Method and Description |
---|---|
static FileSystem |
getCurrent()
Gets the current file system.
|
char[] |
getIllegalFileNameChars()
Gets a cloned copy of the illegal characters for this file system.
|
int |
getMaxFileNameLength()
Gets the maximum length for file names.
|
int |
getMaxPathLength()
Gets the maximum length of the path to a file.
|
String[] |
getReservedFileNames()
Gets a cloned copy of the reserved file names.
|
boolean |
isCasePreserving()
Whether this file system preserves case.
|
boolean |
isCaseSensitive()
Whether this file system is case-sensitive.
|
boolean |
isLegalFileName(CharSequence candidate)
Checks if a candidate file name (without a path) such as
"filename.ext" or "filename" is a
potentially legal file name. |
boolean |
isReservedFileName(CharSequence candidate)
Returns whether the given string is a reserved file name.
|
String |
toLegalFileName(String candidate,
char replacement)
Converts a candidate file name (without a path) like
"filename.ext" or "filename" to a legal file
name. |
static FileSystem |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static FileSystem[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final FileSystem GENERIC
public static final FileSystem LINUX
public static final FileSystem MAC_OSX
public static final FileSystem WINDOWS
public static FileSystem[] values()
for (FileSystem c : FileSystem.values()) System.out.println(c);
public static FileSystem valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static FileSystem getCurrent()
public char[] getIllegalFileNameChars()
public int getMaxFileNameLength()
public int getMaxPathLength()
public String[] getReservedFileNames()
public boolean isCasePreserving()
public boolean isCaseSensitive()
public boolean isLegalFileName(CharSequence candidate)
"filename.ext"
or "filename"
is a
potentially legal file name. If the file name length exceeds getMaxFileNameLength()
, or if it contains
an illegal character then the check fails.candidate
- a candidate file name (without a path) like "filename.ext"
or "filename"
true
if the candidate name is legalpublic boolean isReservedFileName(CharSequence candidate)
candidate
- the string to testtrue
if the given string is a reserved file name.public String toLegalFileName(String candidate, char replacement)
"filename.ext"
or "filename"
to a legal file
name. Illegal characters in the candidate name are replaced by the replacement
character. If the file
name length exceeds getMaxFileNameLength()
, then the name is truncated to
getMaxFileNameLength()
.candidate
- a candidate file name (without a path) like "filename.ext"
or "filename"
replacement
- Illegal characters in the candidate name are replaced by this characterJas4pp 1.5 © Java Analysis Studio for Particle Physics