org.apache.commons.io

## Class IOExceptionList

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

- All Implemented Interfaces:
    Serializable

      public class IOExceptionList
      extends IOException

  A IOException based on a list of Throwable causes.

  The first exception in the list is used as this exception's cause and is accessible with the usual `Throwable.getCause()` while the complete list is accessible with `getCauseList()`.

  Since:
    2.7
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IOExceptionList(List<? extends Throwable> causeList)` Creates a new exception caused by a list of exceptions.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T extends Throwable> T` | `getCause(int index)` Gets the cause list.
    `<T extends Throwable> T` | `getCause(int index, Class<T> clazz)` Gets the cause list.
    `<T extends Throwable> List<T>` | `getCauseList()` Gets the cause list.
    `<T extends Throwable> List<T>` | `getCauseList(Class<T> clazz)` Works around Throwable and Generics, may fail at runtime depending on the argument value.

    - ### 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

    - #### IOExceptionList

          public IOExceptionList(List<? extends Throwable> causeList)

      Creates a new exception caused by a list of exceptions.
      Parameters:
        `causeList` - a list of cause exceptions.

  - ### Method Detail

    - #### getCauseList

          public <T extends Throwable> List<T> getCauseList()

      Gets the cause list.
      Type Parameters:
        `T` - type of exception to return.
      Returns:
        The list of causes.

    - #### getCause

          public <T extends Throwable> T getCause(int index)

      Gets the cause list.
      Type Parameters:
        `T` - type of exception to return.
      Parameters:
        `index` - index in the cause list.
      Returns:
        The list of causes.

    - #### getCause

          public <T extends Throwable> T getCause(int index,
                                                  Class<T> clazz)

      Gets the cause list.
      Type Parameters:
        `T` - type of exception to return.
      Parameters:
        `index` - index in the cause list.
        `clazz` - type of exception to return.
      Returns:
        The list of causes.

    - #### getCauseList

          public <T extends Throwable> List<T> getCauseList(Class<T> clazz)

      Works around Throwable and Generics, may fail at runtime depending on the argument value.
      Type Parameters:
        `T` - type of exception to return.
      Parameters:
        `clazz` - the target type
      Returns:
        The list of causes.

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