org.knime.core.data.container
Class DCObjectInputVersion2

java.lang.Object
  extended by org.knime.core.data.container.DCObjectInputVersion2
All Implemented Interfaces:
KNIMEStreamConstants

final class DCObjectInputVersion2
extends Object
implements KNIMEStreamConstants

Class interpreting the file format as written by the Buffer class. It supports both modes of DataCell serialization, that is using a DataCellSerializer and a plain java serialization.

This class is the counterpart to DCObjectOutputVersion2, see details on the file format in there.

Author:
Bernd Wiswedel, University of Konstanz

Field Summary
 
Fields inherited from interface org.knime.core.data.container.KNIMEStreamConstants
BYTE_ROW_SEPARATOR, BYTE_TYPE_MISSING, BYTE_TYPE_SERIALIZATION, BYTE_TYPE_START, DUMMY_ROW_KEY, TC_ESCAPE, TC_TERMINATE
 
Constructor Summary
DCObjectInputVersion2(InputStream in, BufferFromFileIteratorVersion20.DataCellStreamReader cellReader)
          Creates new input stream that reads from in.
 
Method Summary
(package private)  void close()
          Closes the underlying streams.
(package private)  void endBlock()
          Pushes the stream forth until a mark is encountered.
(package private)  BlobDataCell.BlobAddress readBlobAddress()
          Reads a blob address from the stream.
(package private)  byte readControlByte()
          Reads a single byte from the stream.
(package private)  DataCell readDataCellPerJavaSerialization()
          Reads a data cell from the stream using java de-serialization.
(package private)  DataCell readDataCellPerKNIMESerializer(DataCellSerializer<? extends DataCell> serializer)
          Reads a data cell from the stream.
(package private)  RowKey readRowKey()
          Reads a row key from the stream.
(package private)  void setCurrentClassLoader(ClassLoader l)
          Set the class loader to ask "first" to load classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DCObjectInputVersion2

DCObjectInputVersion2(InputStream in,
                      BufferFromFileIteratorVersion20.DataCellStreamReader cellReader)
Creates new input stream that reads from in.

Parameters:
in - The stream to read from.
cellReader - The object that helps to read DataCell contained in DataCell as required by DataCellDataInput.readDataCell().
Method Detail

readDataCellPerKNIMESerializer

DataCell readDataCellPerKNIMESerializer(DataCellSerializer<? extends DataCell> serializer)
                                  throws IOException
Reads a data cell from the stream.

Parameters:
serializer - The factory that is used to create the cell
Returns:
A new data cell instance.
Throws:
IOException - If reading fails.
See Also:
DataCellSerializer.deserialize(DataCellDataInput)

readDataCellPerJavaSerialization

DataCell readDataCellPerJavaSerialization()
                                    throws IOException
Reads a data cell from the stream using java de-serialization.

Returns:
A new data cell instance.
Throws:
IOException - If reading fails (also e.g. ClassCastException are wrapped in such IO exceptions).

readBlobAddress

BlobDataCell.BlobAddress readBlobAddress()
                                   throws IOException
Reads a blob address from the stream.

Returns:
as read from the stream.
Throws:
IOException - If that fails.

readRowKey

RowKey readRowKey()
            throws IOException
Reads a row key from the stream.

Returns:
A new row key instance.
Throws:
IOException - If IO problems occur.

readControlByte

byte readControlByte()
               throws IOException
Reads a single byte from the stream.

Returns:
That byte.
Throws:
IOException - If IO problems occur.

endBlock

void endBlock()
        throws IOException
Pushes the stream forth until a mark is encountered.

Throws:
IOException - If IO problems occur.

setCurrentClassLoader

void setCurrentClassLoader(ClassLoader l)
Set the class loader to ask "first" to load classes. Used when a data cell is deserialized and all its member should be loaded in the context of that class loader.

Parameters:
l - The class loader to use, if null it uses the globally known class loader (GlobalClassCreator)

close

void close()
     throws IOException
Closes the underlying streams.

Throws:
IOException - If underlying streams fail to close.


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.