Class BrokenReader

java.lang.Object
java.io.Reader
org.apache.commons.io.input.BrokenReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class BrokenReader extends Reader
Broken reader. This reader always throws an IOException from all the Reader methods where the exception is declared.

This class is mostly useful for testing error handling in code that uses a reader.

Since:
2.7
  • Constructor Details

    • BrokenReader

      public BrokenReader(IOException exception)
      Creates a new reader that always throws the given exception.
      Parameters:
      exception - the exception to be thrown
    • BrokenReader

      public BrokenReader()
      Creates a new reader that always throws an IOException
  • Method Details