uk.org.ogsadai.common
Class BlockReaderInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--uk.org.ogsadai.common.BlockReaderInputStream
- public class BlockReaderInputStream
- extends java.io.InputStream
An java.io.InputStream
that wraps a BlockReader
.
The blocks contained in the BlockReader
must be Strings
, byte[]
or implementations of the org.w3c.dom.Node
interface.
- Author:
- The OGSA-DAI Project Team
Fields inherited from class java.io.InputStream |
|
Method Summary |
private void |
getNodeBlock(org.w3c.dom.Node node)
Converts a block that is a Document Object Model org.w3c.dom.Node into a byte[] and stores this internally. |
private void |
nextBlock()
Gets the next block from the BlockReader if there are any blocks still to get. |
int |
read()
|
int |
read(byte[] bytes, int index, int length)
|
Methods inherited from class java.io.InputStream |
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
- See Also:
- Constant Field Values
mBlockReader
private final BlockReader mBlockReader
-
mBlock
private byte[] mBlock
-
mIndex
private int mIndex
-
mAvailable
private int mAvailable
-
mNeeded
private int mNeeded
-
mAmount
private int mAmount
-
mBytesRead
private int mBytesRead
-
mActive
private boolean mActive
-
mByte
private byte[] mByte
-
BlockReaderInputStream
public BlockReaderInputStream(BlockReader blockReader)
-
Constructs a new object that wraps the given
BlockReader
.
- Parameters:
blockReader
- The BlockReader
to wrap.
read
public int read(byte[] bytes,
int index,
int length)
throws java.io.IOException
-
- Overrides:
read
in class java.io.InputStream
-
java.io.IOException
read
public int read()
throws java.io.IOException
-
- Specified by:
read
in class java.io.InputStream
-
java.io.IOException
nextBlock
private void nextBlock()
throws java.io.IOException
-
Gets the next block from the
BlockReader
if there are any blocks still to get.
-
- Throws:
java.io.IOException
- if an I/O error occurs caused by an unsupported block type being provided by the wrapped BlockReader
. The IOException
will have a UnsupportedBlockException
as its cause.
getNodeBlock
private void getNodeBlock(org.w3c.dom.Node node)
-
Converts a block that is a Document Object Model
org.w3c.dom.Node
into a byte[] and stores this internally.
-
- Parameters:
node
- The Node
to convert.