Methods Summary |
---|
public static int | calculateStorageRequirements(int entryCount)Calculate how many BATBlocks are needed to hold a specified
number of BAT entries.
return (entryCount + _entries_per_block - 1) / _entries_per_block;
|
public static int | calculateXBATStorageRequirements(int entryCount)Calculate how many XBATBlocks are needed to hold a specified
number of BAT entries.
return (entryCount + _entries_per_xbat_block - 1)
/ _entries_per_xbat_block;
|
public static org.apache.poi.poifs.storage.BATBlock[] | createBATBlocks(int[] entries)Create an array of BATBlocks from an array of int block
allocation table entries
int block_count = calculateStorageRequirements(entries.length);
BATBlock[] blocks = new BATBlock[ block_count ];
int index = 0;
int remaining = entries.length;
for (int j = 0; j < entries.length; j += _entries_per_block)
{
blocks[ index++ ] = new BATBlock(entries, j,
(remaining > _entries_per_block)
? j + _entries_per_block
: entries.length);
remaining -= _entries_per_block;
}
return blocks;
|
public static org.apache.poi.poifs.storage.BATBlock[] | createXBATBlocks(int[] entries, int startBlock)Create an array of XBATBlocks from an array of int block
allocation table entries
int block_count =
calculateXBATStorageRequirements(entries.length);
BATBlock[] blocks = new BATBlock[ block_count ];
int index = 0;
int remaining = entries.length;
if (block_count != 0)
{
for (int j = 0; j < entries.length; j += _entries_per_xbat_block)
{
blocks[ index++ ] =
new BATBlock(entries, j,
(remaining > _entries_per_xbat_block)
? j + _entries_per_xbat_block
: entries.length);
remaining -= _entries_per_xbat_block;
}
for (index = 0; index < blocks.length - 1; index++)
{
blocks[ index ].setXBATChain(startBlock + index + 1);
}
blocks[ index ].setXBATChain(POIFSConstants.END_OF_CHAIN);
}
return blocks;
|
public static final int | entriesPerBlock()
return _entries_per_block;
|
public static final int | entriesPerXBATBlock()
return _entries_per_xbat_block;
|
public static final int | getXBATChainOffset()
return _xbat_chain_offset;
|
private void | setXBATChain(int chainIndex)
_fields[ _entries_per_xbat_block ].set(chainIndex, _data);
|
void | writeData(java.io.OutputStream stream)Write the block's data to an OutputStream
doWriteData(stream, _data);
|