HeaderBlockWriterpublic class HeaderBlockWriter extends BigBlock implements HeaderBlockConstantsThe block containing the archive header |
Fields Summary |
---|
private static final byte | _default_value | private IntegerField | _bat_count | private IntegerField | _property_start | private IntegerField | _sbat_start | private IntegerField | _sbat_block_count | private IntegerField | _xbat_start | private IntegerField | _xbat_count | private byte[] | _data |
Constructors Summary |
---|
public HeaderBlockWriter()Create a single instance initialized with default values
_data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
Arrays.fill(_data, _default_value);
new LongField(_signature_offset, _signature, _data);
new IntegerField(0x08, 0, _data);
new IntegerField(0x0c, 0, _data);
new IntegerField(0x10, 0, _data);
new IntegerField(0x14, 0, _data);
new ShortField(0x18, ( short ) 0x3b, _data);
new ShortField(0x1a, ( short ) 0x3, _data);
new ShortField(0x1c, ( short ) -2, _data);
new ShortField(0x1e, ( short ) 0x9, _data);
new IntegerField(0x20, 0x6, _data);
new IntegerField(0x24, 0, _data);
new IntegerField(0x28, 0, _data);
_bat_count = new IntegerField(_bat_count_offset, 0, _data);
_property_start = new IntegerField(_property_start_offset,
POIFSConstants.END_OF_CHAIN,
_data);
new IntegerField(0x34, 0, _data);
new IntegerField(0x38, 0x1000, _data);
_sbat_start = new IntegerField(_sbat_start_offset,
POIFSConstants.END_OF_CHAIN, _data);
_sbat_block_count = new IntegerField(_sbat_block_count_offset, 0,
_data);
_xbat_start = new IntegerField(_xbat_start_offset,
POIFSConstants.END_OF_CHAIN, _data);
_xbat_count = new IntegerField(_xbat_count_offset, 0, _data);
|
Methods Summary |
---|
static int | calculateXBATStorageRequirements(int blockCount)For a given number of BAT blocks, calculate how many XBAT
blocks will be needed
return (blockCount > _max_bats_in_header)
? BATBlock.calculateXBATStorageRequirements(blockCount
- _max_bats_in_header)
: 0;
| public org.apache.poi.poifs.storage.BATBlock[] | setBATBlocks(int blockCount, int startBlock)Set BAT block parameters. Assumes that all BAT blocks are
contiguous. Will construct XBAT blocks if necessary and return
the array of newly constructed XBAT blocks.
BATBlock[] rvalue;
_bat_count.set(blockCount, _data);
int limit = Math.min(blockCount, _max_bats_in_header);
int offset = _bat_array_offset;
for (int j = 0; j < limit; j++)
{
new IntegerField(offset, startBlock + j, _data);
offset += LittleEndianConsts.INT_SIZE;
}
if (blockCount > _max_bats_in_header)
{
int excess_blocks = blockCount - _max_bats_in_header;
int[] excess_block_array = new int[ excess_blocks ];
for (int j = 0; j < excess_blocks; j++)
{
excess_block_array[ j ] = startBlock + j
+ _max_bats_in_header;
}
rvalue = BATBlock.createXBATBlocks(excess_block_array,
startBlock + blockCount);
_xbat_start.set(startBlock + blockCount, _data);
}
else
{
rvalue = BATBlock.createXBATBlocks(new int[ 0 ], 0);
_xbat_start.set(POIFSConstants.END_OF_CHAIN, _data);
}
_xbat_count.set(rvalue.length, _data);
return rvalue;
| public void | setPropertyStart(int startBlock)Set start of Property Table
_property_start.set(startBlock, _data);
| public void | setSBATBlockCount(int count)Set count of SBAT blocks
_sbat_block_count.set(count, _data);
| public void | setSBATStart(int startBlock)Set start of small block allocation table
_sbat_start.set(startBlock, _data);
| void | writeData(java.io.OutputStream stream)Write the block's data to an OutputStream
doWriteData(stream, _data);
|
|