Class DfsReftable.CacheSource

java.lang.Object
org.eclipse.jgit.internal.storage.io.BlockSource
org.eclipse.jgit.internal.storage.dfs.DfsReftable.CacheSource
All Implemented Interfaces:
AutoCloseable
Enclosing class:
DfsReftable

private static final class DfsReftable.CacheSource extends BlockSource
  • Field Details

  • Constructor Details

  • Method Details

    • read

      public ByteBuffer read(long pos, int cnt) throws IOException
      Description copied from class: BlockSource
      Read a block from the file.

      To reduce copying, the returned ByteBuffer should have an accessible array and arrayOffset() == 0. The caller will discard the ByteBuffer and directly use the backing array.

      Specified by:
      read in class BlockSource
      Parameters:
      pos - position of the block in the file, specified in bytes from the beginning of the file.
      cnt - size to read.
      Returns:
      buffer containing the block content.
      Throws:
      IOException - if block cannot be read.
    • notInCache

      private boolean notInCache(long pos)
    • size

      public long size() throws IOException
      Description copied from class: BlockSource
      Determine the size of the file.
      Specified by:
      size in class BlockSource
      Returns:
      total number of bytes in the file.
      Throws:
      IOException - if size cannot be obtained.
    • adviseSequentialRead

      public void adviseSequentialRead(long start, long end)
      Description copied from class: BlockSource
      Advise the BlockSource a sequential scan is starting.
      Overrides:
      adviseSequentialRead in class BlockSource
      Parameters:
      start - starting position.
      end - ending position.
    • open

      private ReadableChannel open() throws IOException
      Throws:
      IOException
    • close

      public void close()
      Description copied from class: BlockSource
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in class BlockSource