Class DeferredSeekablePushbackInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.PushbackInputStream
net.sansa_stack.hadoop.util.DeferredSeekablePushbackInputStream
All Implemented Interfaces:
Closeable, AutoCloseable, SeekableDecorator, org.apache.hadoop.fs.Seekable

public class DeferredSeekablePushbackInputStream extends PushbackInputStream implements SeekableDecorator
A wrapper for hadoop input streams created from codecs in ReadMode.BY_BLOCK: Defers reading by one byte such that position changes are advertised on the byte BEFORE the block boundary rather than on the byte AFTER it.
  • Field Details

    • seekable

      protected org.apache.hadoop.fs.Seekable seekable
    • readMode

      protected net.sansa_stack.hadoop.util.DeferredSeekablePushbackInputStream.ReadMode readMode
      Unsafe reads modify the byte after the reported number of read bytes in the read buffer. Example: If buf := [a, b, c, d] and "read(buf)" returns 3, then buf[3] may no longer hold a 'd'. As this may cause data corruption, safe read mode uses an intermediate buffer with additional copying to prevent changing data outside of the reported range.
    • fallbackBuffer

      protected byte[] fallbackBuffer
  • Constructor Details

    • DeferredSeekablePushbackInputStream

      public DeferredSeekablePushbackInputStream(InputStream in)
    • DeferredSeekablePushbackInputStream

      public DeferredSeekablePushbackInputStream(InputStream in, org.apache.hadoop.fs.Seekable seekable)
  • Method Details