org.apache.poi.poifs.storage
Class RawDataBlock

java.lang.Object
  extended by org.apache.poi.poifs.storage.RawDataBlock
All Implemented Interfaces:
ListManagedBlock

public class RawDataBlock
extends java.lang.Object
implements ListManagedBlock

A big block created from an InputStream, holding the raw data

Author:
Marc Johnson (mjohnson at apache dot org

Constructor Summary
RawDataBlock(java.io.InputStream stream)
          Constructor RawDataBlock
RawDataBlock(java.io.InputStream stream, int blockSize)
          Constructor RawDataBlock
 
Method Summary
 boolean eof()
          When we read the data, did we hit end of file?
 byte[] getData()
          Get the data from the block
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawDataBlock

public RawDataBlock(java.io.InputStream stream)
             throws java.io.IOException
Constructor RawDataBlock

Parameters:
stream - the InputStream from which the data will be read
Throws:
java.io.IOException - on I/O errors, and if an insufficient amount of data is read (the InputStream must be an exact multiple of the block size)

RawDataBlock

public RawDataBlock(java.io.InputStream stream,
                    int blockSize)
             throws java.io.IOException
Constructor RawDataBlock

Parameters:
stream - the InputStream from which the data will be read
blockSize - the size of the POIFS blocks, normally 512 bytes POIFSConstants.BIG_BLOCK_SIZE
Throws:
java.io.IOException - on I/O errors, and if an insufficient amount of data is read (the InputStream must be an exact multiple of the block size)
Method Detail

eof

public boolean eof()
            throws java.io.IOException
When we read the data, did we hit end of file?

Returns:
true if no data was read because we were at the end of the file, else false
Throws:
java.io.IOException

getData

public byte[] getData()
               throws java.io.IOException
Get the data from the block

Specified by:
getData in interface ListManagedBlock
Returns:
the block's data as a byte array
Throws:
java.io.IOException - if there is no data


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.