org.apache.poi.poifs.storage
class: BlockListImpl [javadoc |
source]
java.lang.Object
org.apache.poi.poifs.storage.BlockListImpl
All Implemented Interfaces:
BlockList
Direct Known Subclasses:
RawDataBlockList, LocalRawDataBlockList, SmallDocumentBlockList
A simple implementation of BlockList
- author:
Marc - Johnson (mjohnson at apache dot org
| Method from org.apache.poi.poifs.storage.BlockListImpl Detail: |
public ListManagedBlock[] fetchBlocks(int startBlock) throws IOException {
if (_bat == null)
{
throw new IOException(
"Improperly initialized list: no block allocation table provided");
}
return _bat.fetchBlocks(startBlock, this);
}
get the blocks making up a particular stream in the list. The
blocks are removed from the list. |
public ListManagedBlock remove(int index) throws IOException {
ListManagedBlock result = null;
try
{
result = _blocks[ index ];
if (result == null)
{
throw new IOException("block[ " + index
+ " ] already removed");
}
_blocks[ index ] = null;
}
catch (ArrayIndexOutOfBoundsException ignored)
{
throw new IOException("Cannot remove block[ " + index
+ " ]; out of range[ 0 - " +
(_blocks.length-1) + " ]");
}
return result;
}
remove and return the specified block from the list |
public void setBAT(BlockAllocationTableReader bat) throws IOException {
if (_bat != null)
{
throw new IOException(
"Attempt to replace existing BlockAllocationTable");
}
_bat = bat;
}
set the associated BlockAllocationTable |
protected void setBlocks(ListManagedBlock[] blocks) {
_blocks = blocks;
}
|
public void zap(int index) {
if ((index >= 0) && (index < _blocks.length))
{
_blocks[ index ] = null;
}
}
remove the specified block from the list |