Class DfsReftable.CacheSource

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Enclosing class:
    DfsReftable

    private static final class DfsReftable.CacheSource
    extends BlockSource
    • Method Detail

      • read

        public java.nio.ByteBuffer read​(long pos,
                                        int cnt)
                                 throws java.io.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:
        java.io.IOException - if block cannot be read.
      • notInCache

        private boolean notInCache​(long pos)
      • size

        public long size()
                  throws java.io.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:
        java.io.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 java.io.IOException
        Throws:
        java.io.IOException
      • close

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