Class ProxyInputStream

    • Constructor Summary

      Constructors 
      Constructor Description
      ProxyInputStream​(java.io.InputStream proxy)
      Constructs a new ProxyInputStream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      Invokes the delegate's InputStream.available() method.
      void close()
      Invokes the delegate's InputStream.close() method.
      void mark​(int readLimit)
      Invokes the delegate's InputStream.mark(int) method.
      boolean markSupported()
      Invokes the delegate's InputStream.markSupported() method.
      int read()
      Invokes the delegate's InputStream.read() method unless the stream is closed.
      int read​(byte[] b)
      Invokes the delegate's InputStream.read(byte[]) method.
      int read​(byte[] b, int off, int len)
      Invokes the delegate's InputStream.read(byte[], int, int) method.
      void reset()
      Invokes the delegate's InputStream.reset() method.
      ProxyInputStream setReference​(java.io.InputStream in)
      Sets the underlying input stream.
      long skip​(long n)
      Invokes the delegate's InputStream.skip(long) method.
      java.io.InputStream unwrap()
      Unwraps this instance by returning the underlying InputStream.
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • ProxyInputStream

        public ProxyInputStream​(java.io.InputStream proxy)
        Constructs a new ProxyInputStream.
        Parameters:
        proxy - the InputStream to proxy.
    • Method Detail

      • available

        public int available()
                      throws java.io.IOException
        Invokes the delegate's InputStream.available() method.
        Overrides:
        available in class java.io.FilterInputStream
        Returns:
        the number of available bytes, 0 if the stream is closed.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • close

        public void close()
                   throws java.io.IOException
        Invokes the delegate's InputStream.close() method.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.FilterInputStream
        Throws:
        java.io.IOException - if an I/O error occurs.
      • mark

        public void mark​(int readLimit)
        Invokes the delegate's InputStream.mark(int) method.
        Overrides:
        mark in class java.io.FilterInputStream
        Parameters:
        readLimit - read ahead limit.
      • markSupported

        public boolean markSupported()
        Invokes the delegate's InputStream.markSupported() method.
        Overrides:
        markSupported in class java.io.FilterInputStream
        Returns:
        true if this stream instance supports the mark and reset methods; false otherwise.
        See Also:
        mark(int), reset()
      • read

        public int read()
                 throws java.io.IOException
        Invokes the delegate's InputStream.read() method unless the stream is closed.
        Overrides:
        read in class java.io.FilterInputStream
        Returns:
        the byte read or EOF if we reached the end of stream.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Invokes the delegate's InputStream.read(byte[]) method.
        Overrides:
        read in class java.io.FilterInputStream
        Parameters:
        b - the buffer to read the bytes into.
        Returns:
        the number of bytes read or EOF if we reached the end of stream.
        Throws:
        java.io.IOException -
        • If the first byte cannot be read for any reason other than the end of the file,
        • if the input stream has been closed, or
        • if some other I/O error occurs.
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Invokes the delegate's InputStream.read(byte[], int, int) method.
        Overrides:
        read in class java.io.FilterInputStream
        Parameters:
        b - the buffer to read the bytes into.
        off - The start offset.
        len - The number of bytes to read.
        Returns:
        the number of bytes read or EOF if we reached the end of stream.
        Throws:
        java.io.IOException -
        • If the first byte cannot be read for any reason other than the end of the file,
        • if the input stream has been closed, or
        • if some other I/O error occurs.
      • reset

        public void reset()
                   throws java.io.IOException
        Invokes the delegate's InputStream.reset() method.
        Overrides:
        reset in class java.io.FilterInputStream
        Throws:
        java.io.IOException - if this stream has not been marked or if the mark has been invalidated.
      • setReference

        public ProxyInputStream setReference​(java.io.InputStream in)
        Sets the underlying input stream.
        Parameters:
        in - The input stream to set in FilterInputStream.in.
        Returns:
        this instance.
        Since:
        2.19.0
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Invokes the delegate's InputStream.skip(long) method.
        Overrides:
        skip in class java.io.FilterInputStream
        Parameters:
        n - the number of bytes to skip.
        Returns:
        the actual number of bytes skipped.
        Throws:
        java.io.IOException - if the stream does not support seek, or if some other I/O error occurs.
      • unwrap

        public java.io.InputStream unwrap()
        Unwraps this instance by returning the underlying InputStream.

        Use with caution; useful to query the underlying InputStream.

        Returns:
        the underlying InputStream.
        Since:
        2.16.0