Class TailOverridingRebufferer

java.lang.Object
org.apache.cassandra.io.util.WrappingRebufferer
org.apache.cassandra.io.util.TailOverridingRebufferer
All Implemented Interfaces:
AutoCloseable, ReaderFileProxy, Rebufferer, Rebufferer.BufferHolder

@NotThreadSafe public class TailOverridingRebufferer extends WrappingRebufferer
Special rebufferer that replaces the tail of the file (from the specified cutoff point) with the given buffer.

Instantiated once per RandomAccessReader, thread-unsafe. The instances reuse themselves as the BufferHolder to avoid having to return a new object for each rebuffer call. Only one BufferHolder can be active at a time. Calling rebuffer(long) before the previously obtained buffer holder is released will throw AssertionError.

  • Constructor Details

    • TailOverridingRebufferer

      public TailOverridingRebufferer(Rebufferer source, long cutoff, ByteBuffer tail)
  • Method Details

    • rebuffer

      public Rebufferer.BufferHolder rebuffer(long position)
      Description copied from interface: Rebufferer
      Rebuffer (move on or seek to) a given position, and return a buffer that can be used there. The only guarantee about the size of the returned data is that unless rebuffering at the end of the file, the buffer will not be empty and will contain the requested position, i.e. offset <= position < offset + bh.buffer().limit(), but the buffer will not be positioned there.
      Specified by:
      rebuffer in interface Rebufferer
      Overrides:
      rebuffer in class WrappingRebufferer
    • fileLength

      public long fileLength()
      Specified by:
      fileLength in interface ReaderFileProxy
      Overrides:
      fileLength in class WrappingRebufferer
    • toString

      public String toString()
      Overrides:
      toString in class WrappingRebufferer