org.knime.core.data.container
Class BlockableInputStream
java.lang.Object
java.io.InputStream
org.knime.core.data.container.BlockableInputStream
- All Implemented Interfaces:
- Closeable, KNIMEStreamConstants
final class BlockableInputStream
- extends InputStream
- implements KNIMEStreamConstants
Input Stream that wraps a given input stream and searches for terminated end
blocks. Such a block is typically a serialized
DataCell
. It will simulate an eof file if
it encounters a block end. This class is intended to be used on streams
written with the
BlockableOutputStream
class.
- Author:
- wiswedel, University of Konstanz
- See Also:
BlockableOutputStream
Method Summary |
void |
close()
|
void |
endBlock()
Finishes the current block, i.e. |
int |
read()
Reads next byte from stream and if it is an escape byte, it returns the
next following byte. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BlockableInputStream
BlockableInputStream(InputStream inStream)
- Inits the Stream.
- Parameters:
inStream
- the stream to wrap; must not be null
read
public int read()
throws IOException
- Reads next byte from stream and if it is an escape byte, it returns the
next following byte. If it is a terminate byte, it returns -1, i.e. eof.
- Specified by:
read
in class InputStream
- Throws:
IOException
endBlock
public void endBlock()
throws IOException
- Finishes the current block, i.e. when the block end has already been
reached, releases the block and allows further
read()
operations. Otherwise it will subsequently call read()
until the
block end is reached.
- Throws:
IOException
- if read()
fails
close
public void close()
throws IOException
-
- Specified by:
close
in interface Closeable
- Overrides:
close
in class InputStream
- Throws:
IOException
Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display,
or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the
copyright owner or as specified in the license file distributed with this product.