Class IOExceptionList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.lang.Throwable>

    public class IOExceptionList
    extends java.io.IOException
    implements java.lang.Iterable<java.lang.Throwable>
    An 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 Description
      IOExceptionList​(java.lang.String message, java.util.List<? extends java.lang.Throwable> causeList)
      Creates a new exception caused by a list of exceptions.
      IOExceptionList​(java.util.List<? extends java.lang.Throwable> causeList)
      Creates a new exception caused by a list of exceptions.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkEmpty​(java.util.List<? extends java.lang.Throwable> causeList, java.lang.Object message)
      Throws this exception if the list is not null or empty.
      <T extends java.lang.Throwable>
      T
      getCause​(int index)
      Gets the cause exception at the given index.
      <T extends java.lang.Throwable>
      T
      getCause​(int index, java.lang.Class<T> clazz)
      Gets the cause exception at the given index.
      <T extends java.lang.Throwable>
      java.util.List<T>
      getCauseList()
      Gets the cause list.
      <T extends java.lang.Throwable>
      java.util.List<T>
      getCauseList​(java.lang.Class<T> clazz)
      Works around Throwable and Generics, may fail at runtime depending on the argument value.
      java.util.Iterator<java.lang.Throwable> iterator()  
      • 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

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • IOExceptionList

        public IOExceptionList​(java.util.List<? extends java.lang.Throwable> causeList)
        Creates a new exception caused by a list of exceptions.
        Parameters:
        causeList - a list of cause exceptions.
      • IOExceptionList

        public IOExceptionList​(java.lang.String message,
                               java.util.List<? extends java.lang.Throwable> causeList)
        Creates a new exception caused by a list of exceptions.
        Parameters:
        message - The detail message, see Throwable.getMessage().
        causeList - a list of cause exceptions.
        Since:
        2.9.0
    • Method Detail

      • checkEmpty

        public static void checkEmpty​(java.util.List<? extends java.lang.Throwable> causeList,
                                      java.lang.Object message)
                               throws IOExceptionList
        Throws this exception if the list is not null or empty.
        Parameters:
        causeList - The list to test.
        message - The detail message, see Throwable.getMessage().
        Throws:
        IOExceptionList - if the list is not null or empty.
        Since:
        2.12.0
      • getCause

        public <T extends java.lang.Throwable> T getCause​(int index)
        Gets the cause exception at the given index.
        Type Parameters:
        T - type of exception to return.
        Parameters:
        index - index in the cause list.
        Returns:
        The list of causes.
      • getCause

        public <T extends java.lang.Throwable> T getCause​(int index,
                                                          java.lang.Class<T> clazz)
        Gets the cause exception at the given index.
        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 java.lang.Throwable> java.util.List<T> getCauseList()
        Gets the cause list.
        Type Parameters:
        T - type of exception to return.
        Returns:
        The list of causes.
      • getCauseList

        public <T extends java.lang.Throwable> java.util.List<T> getCauseList​(java.lang.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.
      • iterator

        public java.util.Iterator<java.lang.Throwable> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Throwable>