Enum Class EFileIOErrorCode

java.lang.Object
java.lang.Enum<EFileIOErrorCode>
com.helger.io.file.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
  • Enum Constant Details

    • NO_ERROR

      public static final EFileIOErrorCode NO_ERROR
      Generic error code: no error.
    • OPERATION_FAILED

      public static final EFileIOErrorCode OPERATION_FAILED
      Generic error code: operation failed but we don't know why.
    • SECURITY_ERROR

      public static final EFileIOErrorCode SECURITY_ERROR
      Generic error code: a SecurityException occurred.
    • SOURCE_DOES_NOT_EXIST

      public static final EFileIOErrorCode SOURCE_DOES_NOT_EXIST
      A source file or directory does not exist.
    • TARGET_ALREADY_EXISTS

      public static final EFileIOErrorCode TARGET_ALREADY_EXISTS
      A destination file or directory already exists.
    • SOURCE_EQUALS_TARGET

      public static final EFileIOErrorCode SOURCE_EQUALS_TARGET
      Source and destination object are identical.
    • TARGET_IS_CHILD_OF_SOURCE

      public static final EFileIOErrorCode TARGET_IS_CHILD_OF_SOURCE
      Avoid recursive dependencies.
    • OBJECT_CANNOT_BE_HANDLED

      public static final EFileIOErrorCode OBJECT_CANNOT_BE_HANDLED
      We stumble across an object that is neither a file nor a directory.
    • OBJECT_HAS_NO_PARENT

      public static final EFileIOErrorCode OBJECT_HAS_NO_PARENT
      An object's parent could not be retrieved.
    • SOURCE_NOT_READABLE

      public static final EFileIOErrorCode SOURCE_NOT_READABLE
      The source object cannot be read.
    • SOURCE_PARENT_NOT_WRITABLE

      public static final EFileIOErrorCode SOURCE_PARENT_NOT_WRITABLE
      The source parent object is read-only (not writable).
    • TARGET_PARENT_NOT_WRITABLE

      public static final EFileIOErrorCode TARGET_PARENT_NOT_WRITABLE
      The target parent object is read-only (not writable).
    • IO_ERROR

      public static final EFileIOErrorCode IO_ERROR
      Generic IO code: an IOException occurred.
  • Method Details

    • values

      public static EFileIOErrorCode[] 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

      public static EFileIOErrorCode valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getID

      @Nonnegative public int getID()
      An internal ID for easier referencing. NO_ERROR has ID 0. All errors have positive numbers.
      Specified by:
      getID in interface com.helger.base.id.IHasIntID
    • getAsIOError

      public @NonNull FileIOError getAsIOError(@NonNull EFileIOOperation eOperation, @NonNull File aFile)
      Use this error code to create a new FileIOError instance.
      Parameters:
      eOperation - The operation carried out. May not be null.
      aFile - The file on which operation was carried out. May not be null.
      Returns:
      The new FileIOError and never null.
    • getAsIOError

      public @NonNull FileIOError getAsIOError(@NonNull EFileIOOperation eOperation, @NonNull Path aPath)
      Use this error code to create a new FileIOError instance.
      Parameters:
      eOperation - The operation carried out. May not be null.
      aPath - The path on which operation was carried out. May not be null.
      Returns:
      The new FileIOError and never null.
    • getAsIOError

      public @NonNull FileIOError getAsIOError(@NonNull EFileIOOperation eOperation, @NonNull File aFile1, @NonNull File aFile2)
      Use this error code to create a new FileIOError instance.
      Parameters:
      eOperation - The operation carried out. May not be null.
      aFile1 - The first file on which operation was carried out. May not be null.
      aFile2 - The second file on which operation was carried out. May not be null.
      Returns:
      The new FileIOError and never null.
    • getAsIOError

      public @NonNull FileIOError getAsIOError(@NonNull EFileIOOperation eOperation, @NonNull Path aFile1, @NonNull Path aFile2)
      Use this error code to create a new FileIOError instance.
      Parameters:
      eOperation - The operation carried out. May not be null.
      aFile1 - The first file on which operation was carried out. May not be null.
      aFile2 - The second file on which operation was carried out. May not be null.
      Returns:
      The new FileIOError and never null.
    • isSuccess

      public boolean isSuccess()
      Specified by:
      isSuccess in interface com.helger.base.state.ISuccessIndicator
      Returns:
      true if this is NO_ERROR, false otherwise.
    • getSecurityAsIOError

      public static @NonNull FileIOError getSecurityAsIOError(@NonNull EFileIOOperation eOperation, @NonNull SecurityException ex)
      Static method to create a FileIOError for a SecurityException.
      Parameters:
      eOperation - The performed operation. May not be null.
      ex - The occurred SecurityException. Never null.
      Returns:
      The non-null FileIOError.
    • getAsIOError

      public static @NonNull FileIOError getAsIOError(@NonNull EFileIOOperation eOperation, @NonNull IOException ex)
      Static method to create a FileIOError for an IOException.
      Parameters:
      eOperation - The performed operation. May not be null.
      ex - The occurred IOException. Never null.
      Returns:
      The non-null FileIOError.
    • getAsIOError

      public static @NonNull FileIOError getAsIOError(@NonNull EFileIOOperation eOperation, @NonNull UncheckedIOException ex)
      Static method to create a FileIOError for an UncheckedIOException.
      Parameters:
      eOperation - The performed operation. May not be null.
      ex - The occurred UncheckedIOException. Never null.
      Returns:
      The non-null FileIOError.
    • getFromIDOrNull

      public static @Nullable EFileIOErrorCode getFromIDOrNull(int nID)
      Get the EFileIOErrorCode from the given numeric ID.
      Parameters:
      nID - The ID to resolve.
      Returns:
      null if the ID could not be resolved.