Class BlockStore

  • Direct Known Subclasses:
    POIFSFileSystem, POIFSMiniStore

    public abstract class BlockStore
    extends Object
    This abstract class describes a way to read, store, chain and free a series of blocks (be they Big or Small ones)
    • Constructor Detail

      • BlockStore

        public BlockStore()
    • Method Detail

      • getBlockStoreBlockSize

        protected abstract int getBlockStoreBlockSize()
        Returns the size of the blocks managed through the block store.
      • createBlockIfNeeded

        protected abstract ByteBuffer createBlockIfNeeded​(int offset)
                                                   throws IOException
        Extends the file if required to hold blocks up to the specified offset, and return the block from there.
        Throws:
        IOException
      • releaseBuffer

        protected abstract void releaseBuffer​(ByteBuffer buffer)
        Releases a mmap-ed buffer, which you are sure won't be used again
        Parameters:
        buffer - the buffer
      • getBATBlockAndIndex

        protected abstract BATBlock.BATBlockAndIndex getBATBlockAndIndex​(int offset)
        Returns the BATBlock that handles the specified offset, and the relative index within it
      • getNextBlock

        protected abstract int getNextBlock​(int offset)
        Works out what block follows the specified one.
      • setNextBlock

        protected abstract void setNextBlock​(int offset,
                                             int nextBlock)
        Changes the record of what block follows the specified one.
      • getFreeBlock

        protected abstract int getFreeBlock()
                                     throws IOException
        Finds a free block, and returns its offset. This method will extend the file/stream if needed, and if doing so, allocate new FAT blocks to address the extra space.
        Throws:
        IOException