Class ClosedInputStream

  • All Implemented Interfaces:, java.lang.AutoCloseable

    public class ClosedInputStream
    Closed input stream. This stream returns EOF to all attempts to read something from the stream.

    Typically uses of this class include testing for corner cases in methods that accept input streams and acting as a sentinel value instead of a null input stream.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read()
      Returns -1 to indicate that the stream is closed.
      • Methods inherited from class

        available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail


        public static final ClosedInputStream CLOSED_INPUT_STREAM
        A singleton.
    • Constructor Detail

      • ClosedInputStream

        public ClosedInputStream()
    • Method Detail

      • read

        public int read()
        Returns -1 to indicate that the stream is closed.
        Specified by:
        read in class
        always -1