Methods Summary |
---|
public void | add(org.apache.poi.poifs.storage.RawDataBlock block)add a new block
_list.add(block);
|
public void | createNewBATBlock(int start_index)create a BAT block and add it to the list
byte[] data = new byte[ 512 ];
int offset = 0;
for (int j = 0; j < 128; j++)
{
int index = start_index + j;
if (index % 256 == 0)
{
LittleEndian.putInt(data, offset, -1);
}
else if (index % 256 == 255)
{
LittleEndian.putInt(data, offset, -2);
}
else
{
LittleEndian.putInt(data, offset, index + 1);
}
offset += LittleEndianConsts.INT_SIZE;
}
add(new RawDataBlock(new ByteArrayInputStream(data)));
|
public void | createNewXBATBlock(int start, int end, int chain)create and a new XBAT block
byte[] data = new byte[ 512 ];
int offset = 0;
for (int k = start; k <= end; k++)
{
LittleEndian.putInt(data, offset, k);
offset += LittleEndianConsts.INT_SIZE;
}
while (offset != 508)
{
LittleEndian.putInt(data, offset, -1);
offset += LittleEndianConsts.INT_SIZE;
}
LittleEndian.putInt(data, offset, chain);
add(new RawDataBlock(new ByteArrayInputStream(data)));
|
private void | ensureArrayExists()
if (_array == null)
{
_array = ( RawDataBlock [] ) _list.toArray(new RawDataBlock[ 0 ]);
}
|
public void | fill(int count)fill the list with dummy blocks
int limit = 128 * count;
for (int j = _list.size(); j < limit; j++)
{
add(new RawDataBlock(new ByteArrayInputStream(new byte[ 0 ])));
}
|
public org.apache.poi.poifs.storage.ListManagedBlock | remove(int index)override of remove method
ensureArrayExists();
RawDataBlock rvalue = null;
try
{
rvalue = _array[ index ];
if (rvalue == null)
{
throw new IOException("index " + index + " is null");
}
_array[ index ] = null;
}
catch (ArrayIndexOutOfBoundsException ignored)
{
throw new IOException("Cannot remove block[ " + index
+ " ]; out of range");
}
return rvalue;
|
public void | zap(int index)remove the specified block from the list
ensureArrayExists();
if ((index >= 0) && (index < _array.length))
{
_array[ index ] = null;
}
|