Package com.helger.commons.io.file
Enum EFileIOErrorCode
- All Implemented Interfaces:
IHasIntID,ISuccessIndicator,Serializable,Comparable<EFileIOErrorCode>,java.lang.constant.Constable
Represents a set of predefined error codes that can occur in file operations.
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionGeneric IO code: an IOException occurred.Generic error code: no error.We stumble across an object that is neither a file nor a directory.An object's parent could not be retrieved.Generic error code: operation failed but we don't know why.Generic error code: a SecurityException occurred.A source file or directory does not exist.Source and destination object are identical.The source object cannot be read.The source parent object is read-only (not writable).A destination file or directory already exists.Avoid recursive dependencies.The target parent object is read-only (not writable). -
Method Summary
Modifier and TypeMethodDescriptiongetAsIOError(EFileIOOperation eOperation, File aFile) Use this error code to create a newFileIOErrorinstance.getAsIOError(EFileIOOperation eOperation, File aFile1, File aFile2) Use this error code to create a newFileIOErrorinstance.static FileIOErrorgetAsIOError(EFileIOOperation eOperation, IOException ex) Static method to create aFileIOErrorfor anIOException.static FileIOErrorgetAsIOError(EFileIOOperation eOperation, UncheckedIOException ex) Static method to create aFileIOErrorfor anUncheckedIOException.getAsIOError(EFileIOOperation eOperation, Path aPath) Use this error code to create a newFileIOErrorinstance.getAsIOError(EFileIOOperation eOperation, Path aFile1, Path aFile2) Use this error code to create a newFileIOErrorinstance.static EFileIOErrorCodegetFromIDOrNull(int nID) intgetID()An internal ID for easier referencing.static FileIOErrorgetSecurityAsIOError(EFileIOOperation eOperation, SecurityException ex) Static method to create aFileIOErrorfor aSecurityException.booleanstatic EFileIOErrorCodeReturns the enum constant of this type with the specified name.static EFileIOErrorCode[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface com.helger.commons.state.ISuccessIndicator
and, isFailure, or
-
Enum Constant Details
-
NO_ERROR
Generic error code: no error. -
OPERATION_FAILED
Generic error code: operation failed but we don't know why. -
SECURITY_ERROR
Generic error code: a SecurityException occurred. -
SOURCE_DOES_NOT_EXIST
A source file or directory does not exist. -
TARGET_ALREADY_EXISTS
A destination file or directory already exists. -
SOURCE_EQUALS_TARGET
Source and destination object are identical. -
TARGET_IS_CHILD_OF_SOURCE
Avoid recursive dependencies. -
OBJECT_CANNOT_BE_HANDLED
We stumble across an object that is neither a file nor a directory. -
OBJECT_HAS_NO_PARENT
An object's parent could not be retrieved. -
SOURCE_NOT_READABLE
The source object cannot be read. -
SOURCE_PARENT_NOT_WRITABLE
The source parent object is read-only (not writable). -
TARGET_PARENT_NOT_WRITABLE
The target parent object is read-only (not writable). -
IO_ERROR
Generic IO code: an IOException occurred.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getID
An internal ID for easier referencing.NO_ERRORhas ID 0. All errors have positive numbers. -
getAsIOError
Use this error code to create a newFileIOErrorinstance.- Parameters:
eOperation- The operation carried out. May not benull.aFile- The file on which operation was carried out. May not benull.- Returns:
- The new
FileIOErrorand nevernull.
-
getAsIOError
Use this error code to create a newFileIOErrorinstance.- Parameters:
eOperation- The operation carried out. May not benull.aPath- The path on which operation was carried out. May not benull.- Returns:
- The new
FileIOErrorand nevernull.
-
getAsIOError
@Nonnull public FileIOError getAsIOError(@Nonnull EFileIOOperation eOperation, @Nonnull File aFile1, @Nonnull File aFile2) Use this error code to create a newFileIOErrorinstance.- Parameters:
eOperation- The operation carried out. May not benull.aFile1- The first file on which operation was carried out. May not benull.aFile2- The second file on which operation was carried out. May not benull.- Returns:
- The new
FileIOErrorand nevernull.
-
getAsIOError
@Nonnull public FileIOError getAsIOError(@Nonnull EFileIOOperation eOperation, @Nonnull Path aFile1, @Nonnull Path aFile2) Use this error code to create a newFileIOErrorinstance.- Parameters:
eOperation- The operation carried out. May not benull.aFile1- The first file on which operation was carried out. May not benull.aFile2- The second file on which operation was carried out. May not benull.- Returns:
- The new
FileIOErrorand nevernull.
-
isSuccess
public boolean isSuccess()- Specified by:
isSuccessin interfaceISuccessIndicator- Returns:
trueif this isNO_ERROR,falseotherwise.
-
getSecurityAsIOError
@Nonnull public static FileIOError getSecurityAsIOError(@Nonnull EFileIOOperation eOperation, @Nonnull SecurityException ex) Static method to create aFileIOErrorfor aSecurityException.- Parameters:
eOperation- The performed operation. May not benull.ex- The occurredSecurityException. Nevernull.- Returns:
- The non-
nullFileIOError.
-
getAsIOError
@Nonnull public static FileIOError getAsIOError(@Nonnull EFileIOOperation eOperation, @Nonnull IOException ex) Static method to create aFileIOErrorfor anIOException.- Parameters:
eOperation- The performed operation. May not benull.ex- The occurredIOException. Nevernull.- Returns:
- The non-
nullFileIOError.
-
getAsIOError
@Nonnull public static FileIOError getAsIOError(@Nonnull EFileIOOperation eOperation, @Nonnull UncheckedIOException ex) Static method to create aFileIOErrorfor anUncheckedIOException.- Parameters:
eOperation- The performed operation. May not benull.ex- The occurredUncheckedIOException. Nevernull.- Returns:
- The non-
nullFileIOError.
-
getFromIDOrNull
-