Class InputStreamStreamInput

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class InputStreamStreamInput
    extends StreamInput
    • Constructor Detail

      • InputStreamStreamInput

        public InputStreamStreamInput​(java.io.InputStream is)
        Creates a new InputStreamStreamInput with unlimited size
        Parameters:
        is - the input stream to wrap
      • InputStreamStreamInput

        public InputStreamStreamInput​(java.io.InputStream is,
                                      long sizeLimit)
        Creates a new InputStreamStreamInput with a size limit
        Parameters:
        is - the input stream to wrap
        sizeLimit - a hard limit of the number of bytes in the given input stream. This is used for internal input validation
    • Method Detail

      • readByte

        public byte readByte()
                      throws java.io.IOException
        Description copied from class: StreamInput
        Reads and returns a single byte.
        Specified by:
        readByte in class StreamInput
        Throws:
        java.io.IOException
      • readBytes

        public void readBytes​(byte[] b,
                              int offset,
                              int len)
                       throws java.io.IOException
        Description copied from class: StreamInput
        Reads a specified number of bytes into an array at the specified offset.
        Specified by:
        readBytes in class StreamInput
        Parameters:
        b - the array to read bytes into
        offset - the offset in the array to start storing bytes
        len - the number of bytes to read
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: StreamInput
        Closes the stream to further operations.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class StreamInput
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Specified by:
        available in class StreamInput
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
      • ensureCanReadBytes

        protected void ensureCanReadBytes​(int length)
                                   throws java.io.EOFException
        Description copied from class: StreamInput
        This method throws an EOFException if the given number of bytes can not be read from the this stream. This method might be a no-op depending on the underlying implementation if the information of the remaining bytes is not present.
        Specified by:
        ensureCanReadBytes in class StreamInput
        Throws:
        java.io.EOFException