Top Description Fields Constructors Methods
org.apache.poi.poifs.filesystem

public Class POIFSMiniStore

extends BlockStore
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.Iterator, .List, .NoSuchElementException, org.apache.poi.poifs.common.POIFSConstants, org.apache.poi.poifs.property.RootProperty, org.apache.poi.poifs.storage.BATBlock, .BATBlock.BATBlockAndIndex, .HeaderBlock, org.apache.poi.util.RecordFormatException

This class handles the MiniStream (small block store) in the NIO case for POIFSFileSystem

Field Summary

Modifier and TypeField and Description
private final POIFSFileSystem
private final HeaderBlock
private POIFSStream
private final RootProperty
private final List<BATBlock>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected ByteBuffer
createBlockIfNeeded(final int offset)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.createBlockIfNeeded.

Load the block, extending the underlying stream if needed

protected BATBlock.BATBlockAndIndex
getBATBlockAndIndex(final int offset)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getBATBlockAndIndex.

Returns the BATBlock that handles the specified offset, and the relative index within it

protected ByteBuffer
getBlockAt(final int offset)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getBlockAt.

Load the block at the given offset.

protected int
getBlockStoreBlockSize()

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getBlockStoreBlockSize.

Returns the size of the blocks managed through the block store.

protected BlockStore.ChainLoopDetector
getChainLoopDetector()

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getChainLoopDetector.

Creates a Detector for loops in the chain

protected int
getFreeBlock()

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getFreeBlock.

Finds a free block, and returns its offset.

protected int
getNextBlock(final int offset)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getNextBlock.

Works out what block follows the specified one.

protected void
releaseBuffer(ByteBuffer
the buffer
buffer
)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.releaseBuffer.

Releases a mmap-ed buffer, which you are sure won't be used again

protected void
setNextBlock(final int offset, final int nextBlock)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.setNextBlock.

Changes the record of what block follows the specified one.

pack-priv void
syncWithDataSource()

Writes the SBATs to their backing blocks, and updates the mini-stream size in the properties.

Field Detail

_filesystemback to summary
private final POIFSFileSystem _filesystem
_headerback to summary
private final HeaderBlock _header
_mini_streamback to summary
private POIFSStream _mini_stream
_rootback to summary
private final RootProperty _root
_sbat_blocksback to summary
private final List<BATBlock> _sbat_blocks

Constructor Detail

POIFSMiniStoreback to summary
pack-priv POIFSMiniStore(POIFSFileSystem filesystem, RootProperty root, List<BATBlock> sbats, HeaderBlock header)

Method Detail

createBlockIfNeededback to summary
protected ByteBuffer createBlockIfNeeded(final int offset) throws IOException

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.createBlockIfNeeded.

Load the block, extending the underlying stream if needed

getBATBlockAndIndexback to summary
protected BATBlock.BATBlockAndIndex getBATBlockAndIndex(final int offset)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getBATBlockAndIndex.

Returns the BATBlock that handles the specified offset, and the relative index within it

getBlockAtback to summary
protected ByteBuffer getBlockAt(final int offset) throws IOException

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getBlockAt.

Load the block at the given offset.

getBlockStoreBlockSizeback to summary
protected int getBlockStoreBlockSize()

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getBlockStoreBlockSize.

Doc from org.apache.poi.poifs.filesystem.BlockStore.getBlockStoreBlockSize.

Returns the size of the blocks managed through the block store.

getChainLoopDetectorback to summary
protected BlockStore.ChainLoopDetector getChainLoopDetector()

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getChainLoopDetector.

Doc from org.apache.poi.poifs.filesystem.BlockStore.getChainLoopDetector.

Creates a Detector for loops in the chain

Annotations
@Override
getFreeBlockback to summary
protected int getFreeBlock() throws IOException

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.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.

getNextBlockback to summary
protected int getNextBlock(final int offset)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.getNextBlock.

Works out what block follows the specified one.

releaseBufferback to summary
protected void releaseBuffer(ByteBuffer buffer)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.releaseBuffer.

Doc from org.apache.poi.poifs.filesystem.BlockStore.releaseBuffer.

Releases a mmap-ed buffer, which you are sure won't be used again

Parameters
buffer:ByteBuffer

the buffer

Annotations
@Override
setNextBlockback to summary
protected void setNextBlock(final int offset, final int nextBlock)

Implements abstract org.apache.poi.poifs.filesystem.BlockStore.setNextBlock.

Changes the record of what block follows the specified one.

syncWithDataSourceback to summary
pack-priv void syncWithDataSource() throws 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