Class NPOIFSMiniStore

java.lang.Object
org.docx4j.org.apache.poi.poifs.filesystem.BlockStore
org.docx4j.org.apache.poi.poifs.filesystem.NPOIFSMiniStore

public class NPOIFSMiniStore
extends BlockStore
This class handles the MiniStream (small block store) in the NIO case for NPOIFSFileSystem
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.docx4j.org.apache.poi.poifs.filesystem.BlockStore

    BlockStore.ChainLoopDetector
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected NPOIFSMiniStore​(NPOIFSFileSystem filesystem, RootProperty root, java.util.List<BATBlock> sbats, HeaderBlock header)  
  • Method Summary

    Modifier and Type Method Description
    protected java.nio.ByteBuffer createBlockIfNeeded​(int offset)
    Load the block, extending the underlying stream if needed
    protected BATBlock.BATBlockAndIndex getBATBlockAndIndex​(int offset)
    Returns the BATBlock that handles the specified offset, and the relative index within it
    protected java.nio.ByteBuffer getBlockAt​(int offset)
    Load the block at the given offset.
    protected int getBlockStoreBlockSize()
    Returns the size of the blocks managed through the block store.
    protected BlockStore.ChainLoopDetector getChainLoopDetector()
    Creates a Detector for loops in the chain
    protected int getFreeBlock()
    Finds a free block, and returns its offset.
    protected int getNextBlock​(int offset)
    Works out what block follows the specified one.
    protected void setNextBlock​(int offset, int nextBlock)
    Changes the record of what block follows the specified one.
    protected void syncWithDataSource()
    Writes the SBATs to their backing blocks, and updates the mini-stream size in the properties.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getBlockAt

      protected java.nio.ByteBuffer getBlockAt​(int offset) throws java.io.IOException
      Load the block at the given offset.
      Specified by:
      getBlockAt in class BlockStore
      Throws:
      java.io.IOException
    • createBlockIfNeeded

      protected java.nio.ByteBuffer createBlockIfNeeded​(int offset) throws java.io.IOException
      Load the block, extending the underlying stream if needed
      Specified by:
      createBlockIfNeeded in class BlockStore
      Throws:
      java.io.IOException
    • getBATBlockAndIndex

      protected BATBlock.BATBlockAndIndex getBATBlockAndIndex​(int offset)
      Returns the BATBlock that handles the specified offset, and the relative index within it
      Specified by:
      getBATBlockAndIndex in class BlockStore
    • getNextBlock

      protected int getNextBlock​(int offset)
      Works out what block follows the specified one.
      Specified by:
      getNextBlock in class BlockStore
    • setNextBlock

      protected void setNextBlock​(int offset, int nextBlock)
      Changes the record of what block follows the specified one.
      Specified by:
      setNextBlock in class BlockStore
    • getFreeBlock

      protected int getFreeBlock() throws java.io.IOException
      Finds a free block, and returns its offset. This method will extend the file if needed, and if doing so, allocate new FAT blocks to address the extra space.
      Specified by:
      getFreeBlock in class BlockStore
      Throws:
      java.io.IOException
    • getChainLoopDetector

      protected BlockStore.ChainLoopDetector getChainLoopDetector() throws java.io.IOException
      Description copied from class: BlockStore
      Creates a Detector for loops in the chain
      Specified by:
      getChainLoopDetector in class BlockStore
      Throws:
      java.io.IOException
    • getBlockStoreBlockSize

      protected int getBlockStoreBlockSize()
      Description copied from class: BlockStore
      Returns the size of the blocks managed through the block store.
      Specified by:
      getBlockStoreBlockSize in class BlockStore
    • syncWithDataSource

      protected void syncWithDataSource() throws java.io.IOException
      Writes the SBATs to their backing blocks, and updates the mini-stream size in the properties. Stream size is based on full blocks used, not the data within the streams
      Throws:
      java.io.IOException