Class ExtendedBufferedInputStream

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

    public class ExtendedBufferedInputStream
    extends java.io.BufferedInputStream
    A buffered input stream that gives with the ability to get the number of bytes left in the buffer and a method for discarding the buffer.
    • Field Summary

      • Fields inherited from class java.io.BufferedInputStream

        buf, count, marklimit, markpos, pos
      • Fields inherited from class java.io.FilterInputStream

        in
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void discardBuffer()
      Discard the remaining buffer.
      int getBufferedByteCount()  
      • Methods inherited from class java.io.BufferedInputStream

        available, close, mark, markSupported, read, read, reset, skip
      • Methods inherited from class java.io.FilterInputStream

        read
      • Methods inherited from class java.io.InputStream

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

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

      • ExtendedBufferedInputStream

        public ExtendedBufferedInputStream​(java.io.InputStream in)
        Parameters:
        in - Underlying input stream
      • ExtendedBufferedInputStream

        public ExtendedBufferedInputStream​(java.io.InputStream in,
                                           int size)
        Parameters:
        in - Underlying input stream
        size - Size of the buffer
    • Method Detail

      • getBufferedByteCount

        public int getBufferedByteCount()
        Returns:
        The number of bytes left in the buffer. This is useful for calculating the actual position in the buffer if the position in the underlying buffer is known.
      • discardBuffer

        public void discardBuffer()
        Discard the remaining buffer. This should be called after seek has been performed on the underlying stream.