public class BlockInputStream extends Object implements IBlockInput
| Modifier and Type | Field and Description |
|---|---|
protected InputStream |
in |
protected byte[] |
intBuff |
static int |
maximumInputBlockSize
By default this is 5 MB.
|
| Constructor and Description |
|---|
BlockInputStream(InputStream in)
Create a BlockInputStream using the provided InputStream for reading
in data.
|
| Modifier and Type | Method and Description |
|---|---|
int |
blockRead(ByteArray dest)
Read and append a block to the destination ByteArray.
|
void |
close()
close this BlockInputStream and the underlying input stream.
|
protected void |
decrypt(byte[] data,
int offset,
int length,
ByteArray dest)
If the incoming data block is encoded/encrypted then after it is read in the raw bytes
are passed to this method before being returned.
|
ByteArray |
readBlock()
This is used to read the next block of incoming data.
|
ByteArray |
readBlock(ByteArray dest)
This is used to read the next block of incoming data.
|
protected InputStream in
protected byte[] intBuff
public static int maximumInputBlockSize
public BlockInputStream(InputStream in)
public ByteArray readBlock(ByteArray dest) throws IOException, UnknownEncodingException
dest - an optional destination ByteArray. If this is null a new one is created.
The destination ByteArray is always cleared before the new data is added.IOException - if an error occured reading or decoding or decrypting the data.UnknownEncodingException - if the data could not be decoded/decrypted.protected void decrypt(byte[] data,
int offset,
int length,
ByteArray dest)
throws UnknownEncodingException,
IOException
data - the data bytes read in.offset - the offset of the data.length - the number of bytes of data.dest - a destination ByteArray that will not be null and would have been
cleared before being passed here.UnknownEncodingException - if the data could not be decoded/decrypted.IOException - if there was a problem decrypting the data.public final ByteArray readBlock() throws IOException
IOException - if an error occured reading or decoding or decrypting the data.public void close()
throws IOException
close in interface IBlockInputIOException - if an error occured closing the underlying stream.public int blockRead(ByteArray dest) throws IOException
IBlockInputblockRead in interface IBlockInputdest - the destination ByteArray, which must not be null.IOException