Class CircularBufferInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.buffer.CircularBufferInputStream
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
PeekableInputStream

public class CircularBufferInputStream extends FilterInputStream
Implements a buffered input stream, which is internally based on a CircularByteBuffer. Unlike the BufferedInputStream, this one doesn't need to reallocate byte arrays internally.
  • Field Details

    • buffer

      protected final CircularByteBuffer buffer
      Internal buffer.
    • bufferSize

      protected final int bufferSize
      Internal buffer size.
    • eof

      private boolean eof
      Whether we've seen the input stream EOF.
  • Constructor Details

    • CircularBufferInputStream

      public CircularBufferInputStream(InputStream inputStream)
      Constructs a new instance, which filters the given input stream, and uses a reasonable default buffer size (IOUtils.DEFAULT_BUFFER_SIZE).
      Parameters:
      inputStream - The input stream, which is being buffered.
    • CircularBufferInputStream

      public CircularBufferInputStream(InputStream inputStream, int bufferSize)
      Constructs a new instance, which filters the given input stream, and uses the given buffer size.
      Parameters:
      inputStream - The input stream, which is being buffered.
      bufferSize - The size of the CircularByteBuffer, which is used internally.
  • Method Details