Class SeekableReadableChannelOverBlocks

java.lang.Object
org.aksw.commons.util.closeable.AutoCloseableBase
org.aksw.commons.util.closeable.AutoCloseableWithLeakDetectionBase
All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable, Channel, HasArrayOps<byte[]>, HasPosition, ReadableChannel<byte[]>, ReadableSource<byte[]>, SeekableReadableChannel<byte[]>

public class SeekableReadableChannelOverBlocks extends SeekableReadableChannelBase<byte[]>
  • Field Details

    • blockSource

      protected BlockSource blockSource
    • channel

      protected BlockSourceChannel channel
    • firstBlockId

      protected long firstBlockId
    • currentBlockLogicalOffset

      protected long currentBlockLogicalOffset
    • currentBlock

      protected Block currentBlock
    • currentBlockId

      protected long currentBlockId
    • currentLogicalPos

      protected long currentLogicalPos
    • globalCache

      protected com.github.benmanes.caffeine.cache.Cache<Long,Block> globalCache
    • blockIdToBlock

      protected NavigableMap<Long,Block> blockIdToBlock
    • logicalPosToBlockId

      protected NavigableMap<Long,Long> logicalPosToBlockId
  • Constructor Details

    • SeekableReadableChannelOverBlocks

      public SeekableReadableChannelOverBlocks(BlockSource blockSource, long firstBlockId, com.github.benmanes.caffeine.cache.Cache<Long,Block> globalCache)
      Parameters:
      blockSource -
      channel - The initial channel positioned at the beginning of a block.
      globalCache -
  • Method Details

    • getKnownBlocks

      public Collection<Block> getKnownBlocks()
    • cloneObject

      public SeekableReadableChannel<byte[]> cloneObject()
    • isPosValidInBlock

      protected boolean isPosValidInBlock()
    • ensureCurrentBlock

      protected void ensureCurrentBlock()
    • getStartingBlockSize

      public long getStartingBlockSize()
    • getOrLoadBlock

      protected Block getOrLoadBlock(long blockId, long logicalBlockOffset)
    • read

      public int read(byte[] array, int position, int length) throws IOException
      Throws:
      IOException
    • getArrayOps

      public ArrayOps<byte[]> getArrayOps()
    • position

      public long position() throws IOException
      Throws:
      IOException
    • closeActual

      protected void closeActual() throws Exception
      Overrides:
      closeActual in class org.aksw.commons.util.closeable.AutoCloseableBase
      Throws:
      Exception
    • position

      public void position(long pos) throws IOException
      Throws:
      IOException
    • loadBlock

      public static Block loadBlock(BlockSource blockSource, BlockSourceChannel channel, long thisBlockId) throws IOException
      Throws:
      IOException