RawDataBlockpublic class RawDataBlock extends Object implements ListManagedBlockA big block created from an InputStream, holding the raw data |
Fields Summary |
---|
private byte[] | _data | private boolean | _eof |
Constructors Summary |
---|
public RawDataBlock(InputStream stream)Constructor RawDataBlock
_data = new byte[ POIFSConstants.BIG_BLOCK_SIZE ];
int count = IOUtils.readFully(stream, _data);
if (count == -1)
{
_eof = true;
}
else if (count != POIFSConstants.BIG_BLOCK_SIZE)
{
if (count == -1)
//Cant have -1 bytes read in the error message!
count = 0;
String type = " byte" + ((count == 1) ? ("")
: ("s"));
throw new IOException("Unable to read entire block; " + count
+ type + " read; expected "
+ POIFSConstants.BIG_BLOCK_SIZE + " bytes");
}
else
{
_eof = false;
}
|
Methods Summary |
---|
public boolean | eof()When we read the data, did we hit end of file?
return _eof;
| public byte[] | getData()Get the data from the block
if (eof())
{
throw new IOException("Cannot return empty data");
}
return _data;
|
|