Class NullInputStream

    • Constructor Detail

      • NullInputStream

        public NullInputStream()
        Constructs a new NullInputStream with a default input size of 0.

        The first read will always produce an EOF.

      • NullInputStream

        public NullInputStream​(int size)
        Constructs a new NullInputStream with the specified input size.
        Parameters:
        size - The number of bytes to simulate in the input
    • Method Detail

      • read

        public int read()
                 throws IOException
        “Reads” one byte from the NullInputStream, returning 0 if we have not exhausted the given pool of bytes (specified by ‘size’) and -1 (EOF) if we have.
        Specified by:
        read in class InputStream
        Returns:
        0 or -1
        Throws:
        IOException - never, but the interface requires it