org.apache.commons.io

## Class DirectoryWalker.CancelException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - org.apache.commons.io.DirectoryWalker.CancelException

- All Implemented Interfaces:
    Serializable
  Enclosing class:
    DirectoryWalker<T>

      public static class DirectoryWalker.CancelException
      extends IOException

  CancelException is thrown in DirectoryWalker to cancel the current processing.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CancelException(File file, int depth)` Constructs a `DirectoryWalker.CancelException` with the file and depth when cancellation occurred.
    `CancelException(String message, File file, int depth)` Constructs a `DirectoryWalker.CancelException` with an appropriate message and the file and depth when cancellation occurred.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDepth()` Returns the depth when the operation was cancelled.
    `File` | `getFile()` Returns the file when the operation was cancelled.

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CancelException

          public CancelException(File file,
                                 int depth)

      Constructs a `DirectoryWalker.CancelException` with the file and depth when cancellation occurred.
      Parameters:
        `file` - the file when the operation was cancelled, may be null
        `depth` - the depth when the operation was cancelled, may be null

    - #### CancelException

          public CancelException(String message,
                                 File file,
                                 int depth)

      Constructs a `DirectoryWalker.CancelException` with an appropriate message and the file and depth when cancellation occurred.
      Parameters:
        `message` - the detail message
        `file` - the file when the operation was cancelled
        `depth` - the depth when the operation was cancelled

  - ### Method Detail

    - #### getDepth

          public int getDepth()

      Returns the depth when the operation was cancelled.
      Returns:
        the depth when the operation was cancelled

    - #### getFile

          public File getFile()

      Returns the file when the operation was cancelled.
      Returns:
        the file when the operation was cancelled

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.