Enum Class FileExistsMode
- All Implemented Interfaces:
Serializable
,Comparable<FileExistsMode>
,Constable
When writing file, this enumeration indicates what action shall be taken in
case the destination file already exists.
- Since:
- 2.2
- Author:
- Gunnar Hillert, Gary Russell
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAppend data to any pre-existing files; close after each append.Append data to any pre-existing files; do not flush/close after appending.Raise an exception in case the file to be written already exists.If the file already exists, do nothing.If the file already exists, replace it.If the file already exists, replace it only if the last modified time is different. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileExistsMode
getForString
(String fileExistsModeAsString) For a given non-null and not-empty input string, this method returns the correspondingFileExistsMode
.static FileExistsMode
Returns the enum constant of this class with the specified name.static FileExistsMode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
APPEND
Append data to any pre-existing files; close after each append. -
APPEND_NO_FLUSH
Append data to any pre-existing files; do not flush/close after appending.- Since:
- 4.3
-
FAIL
Raise an exception in case the file to be written already exists. -
IGNORE
If the file already exists, do nothing. -
REPLACE
If the file already exists, replace it. -
REPLACE_IF_MODIFIED
If the file already exists, replace it only if the last modified time is different. Only applies to local files.- Since:
- 5.0
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getForString
For a given non-null and not-empty input string, this method returns the correspondingFileExistsMode
. If it cannot be determined, anIllegalStateException
is thrown.- Parameters:
fileExistsModeAsString
- Must neither be null nor empty- Returns:
- the enum for the string value.
-