Package com.helger.io.file
Enum Class EFileIOErrorCode
- All Implemented Interfaces:
com.helger.base.id.IHasIntID,com.helger.base.state.ISuccessIndicator,Serializable,Comparable<EFileIOErrorCode>,Constable
public enum EFileIOErrorCode
extends Enum<EFileIOErrorCode>
implements com.helger.base.state.ISuccessIndicator, com.helger.base.id.IHasIntID
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 TypeMethodDescription@NonNull FileIOErrorgetAsIOError(@NonNull EFileIOOperation eOperation, @NonNull File aFile) Use this error code to create a newFileIOErrorinstance.@NonNull FileIOErrorgetAsIOError(@NonNull EFileIOOperation eOperation, @NonNull File aFile1, @NonNull File aFile2) Use this error code to create a newFileIOErrorinstance.static @NonNull FileIOErrorgetAsIOError(@NonNull EFileIOOperation eOperation, @NonNull IOException ex) Static method to create aFileIOErrorfor anIOException.static @NonNull FileIOErrorgetAsIOError(@NonNull EFileIOOperation eOperation, @NonNull UncheckedIOException ex) Static method to create aFileIOErrorfor anUncheckedIOException.@NonNull FileIOErrorgetAsIOError(@NonNull EFileIOOperation eOperation, @NonNull Path aPath) Use this error code to create a newFileIOErrorinstance.@NonNull FileIOErrorgetAsIOError(@NonNull EFileIOOperation eOperation, @NonNull Path aFile1, @NonNull Path aFile2) Use this error code to create a newFileIOErrorinstance.static @Nullable EFileIOErrorCodegetFromIDOrNull(int nID) Get theEFileIOErrorCodefrom the given numeric ID.intgetID()An internal ID for easier referencing.static @NonNull FileIOErrorgetSecurityAsIOError(@NonNull EFileIOOperation eOperation, @NonNull SecurityException ex) Static method to create aFileIOErrorfor aSecurityException.booleanstatic EFileIOErrorCodeReturns the enum constant of this class with the specified name.static EFileIOErrorCode[]values()Returns an array containing the constants of this enum class, 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.base.id.IHasIntID
getIDObjMethods inherited from interface com.helger.base.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 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
-
getID
@Nonnegative public int getID()An internal ID for easier referencing.NO_ERRORhas ID 0. All errors have positive numbers.- Specified by:
getIDin interfacecom.helger.base.id.IHasIntID
-
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
public @NonNull 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
public @NonNull 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 interfacecom.helger.base.state.ISuccessIndicator- Returns:
trueif this isNO_ERROR,falseotherwise.
-
getSecurityAsIOError
public static @NonNull 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
public static @NonNull 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
public static @NonNull 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
Get theEFileIOErrorCodefrom the given numeric ID.- Parameters:
nID- The ID to resolve.- Returns:
nullif the ID could not be resolved.
-