Class NullInputStream

  • All Implemented Interfaces:
    it.unimi.dsi.fastutil.io.MeasurableStream, it.unimi.dsi.fastutil.io.RepositionableStream, java.io.Closeable, java.io.Serializable, java.lang.AutoCloseable

    public class NullInputStream
    extends it.unimi.dsi.fastutil.io.MeasurableInputStream
    implements it.unimi.dsi.fastutil.io.RepositionableStream, java.io.Serializable
    End-of-stream-only input stream.

    This stream has length 0, and will always return end-of-file on any read attempt.

    This class is a singleton. You cannot create a null input stream, but you can obtain an instance of this class using getInstance().

    Since:
    0.8
    Author:
    Sebastiano Vigna
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static NullInputStream getInstance()
      Returns the only instance of this class.
      long length()  
      long position()  
      void position​(long position)  
      int read()  
      • Methods inherited from class java.io.InputStream

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

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • read

        public int read()
        Specified by:
        read in class java.io.InputStream
      • getInstance

        public static NullInputStream getInstance()
        Returns the only instance of this class.
        Returns:
        the only instance of this class.
      • length

        public long length()
        Specified by:
        length in interface it.unimi.dsi.fastutil.io.MeasurableStream
      • position

        public long position()
        Specified by:
        position in interface it.unimi.dsi.fastutil.io.MeasurableStream
        Specified by:
        position in interface it.unimi.dsi.fastutil.io.RepositionableStream
      • position

        public void position​(long position)
                      throws java.io.IOException
        Specified by:
        position in interface it.unimi.dsi.fastutil.io.RepositionableStream
        Throws:
        java.io.IOException