org.apache.commons.io.input

Class BrokenInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class BrokenInputStream
    extends InputStream
    Broken input stream. This stream always throws an IOException from all the InputStream methods where the exception is declared.

    This class is mostly useful for testing error handling in code that uses an input stream.

    Since:
    2.0
    • Constructor Detail

      • BrokenInputStream

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

        public BrokenInputStream()
        Creates a new stream that always throws an IOException

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