Class AbstractBufferingStream

java.lang.Object
org.archive.streamcontext.AbstractBufferingStream
All Implemented Interfaces:
Closeable, AutoCloseable, Stream
Direct Known Subclasses:
ByteArrayWrappedStream, HDFSStream, HTTP11Stream, RandomAccessFileStream, SimpleStream

public abstract class AbstractBufferingStream extends Object implements Stream
Class which implements the bulk of the functionality needed for Stream behavior, leaving concrete subclasses to implement only 3 simple methods beyond their constructors: doSeek() doRead() doClose() This class maintains a buffer of bytes read, and attempts to be efficient about seeks within that buffer.
Author:
brad
  • Field Details

    • DEFAULT_READ_SIZE

      protected static int DEFAULT_READ_SIZE
    • offset

      protected long offset
    • closed

      protected boolean closed
    • atEof

      protected boolean atEof
    • buffer

      protected byte[] buffer
    • bufferRemaining

      protected int bufferRemaining
    • bufferCursor

      protected int bufferCursor
  • Constructor Details

    • AbstractBufferingStream

      public AbstractBufferingStream()
    • AbstractBufferingStream

      public AbstractBufferingStream(long offset)
    • AbstractBufferingStream

      public AbstractBufferingStream(long offset, int readSize)
  • Method Details