Class NPOIFSMiniStore
java.lang.Object
org.docx4j.org.apache.poi.poifs.filesystem.BlockStore
org.docx4j.org.apache.poi.poifs.filesystem.NPOIFSMiniStore
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
ConstructorsModifierConstructorDescriptionprotectedNPOIFSMiniStore(NPOIFSFileSystem filesystem, RootProperty root, List<BATBlock> sbats, HeaderBlock header) -
Method Summary
Modifier and TypeMethodDescriptionprotected ByteBuffercreateBlockIfNeeded(int offset) Load the block, extending the underlying stream if neededprotected BATBlock.BATBlockAndIndexgetBATBlockAndIndex(int offset) Returns the BATBlock that handles the specified offset, and the relative index within itprotected ByteBuffergetBlockAt(int offset) Load the block at the given offset.protected intReturns the size of the blocks managed through the block store.protected BlockStore.ChainLoopDetectorCreates a Detector for loops in the chainprotected intFinds a free block, and returns its offset.protected intgetNextBlock(int offset) Works out what block follows the specified one.protected voidsetNextBlock(int offset, int nextBlock) Changes the record of what block follows the specified one.protected voidWrites the SBATs to their backing blocks, and updates the mini-stream size in the properties.
-
Constructor Details
-
NPOIFSMiniStore
protected NPOIFSMiniStore(NPOIFSFileSystem filesystem, RootProperty root, List<BATBlock> sbats, HeaderBlock header)
-
-
Method Details
-
getBlockAt
Load the block at the given offset.- Specified by:
getBlockAtin classBlockStore- Throws:
IOException
-
createBlockIfNeeded
Load the block, extending the underlying stream if needed- Specified by:
createBlockIfNeededin classBlockStore- Throws:
IOException
-
getBATBlockAndIndex
Returns the BATBlock that handles the specified offset, and the relative index within it- Specified by:
getBATBlockAndIndexin classBlockStore
-
getNextBlock
protected int getNextBlock(int offset) Works out what block follows the specified one.- Specified by:
getNextBlockin classBlockStore
-
setNextBlock
protected void setNextBlock(int offset, int nextBlock) Changes the record of what block follows the specified one.- Specified by:
setNextBlockin classBlockStore
-
getFreeBlock
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:
getFreeBlockin classBlockStore- Throws:
IOException
-
getChainLoopDetector
Description copied from class:BlockStoreCreates a Detector for loops in the chain- Specified by:
getChainLoopDetectorin classBlockStore- Throws:
IOException
-
getBlockStoreBlockSize
protected int getBlockStoreBlockSize()Description copied from class:BlockStoreReturns the size of the blocks managed through the block store.- Specified by:
getBlockStoreBlockSizein classBlockStore
-
syncWithDataSource
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:
IOException
-