org.knime.core.data.container
Class DCObjectInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ObjectInputStream
          extended by org.knime.core.data.container.DCObjectInputStream
All Implemented Interfaces:
Closeable, DataInput, ObjectInput, ObjectStreamConstants

final class DCObjectInputStream
extends ObjectInputStream

Obsolete input stream to read Files written with Buffer objects in KNIME 1.x (and 2.0TechPreview).

Input stream that is used by the Buffer to read (java.io.-)serialized DataCell (the ones whose type does not support customized reading/writing) and also DataCell objects that have been written using a DataCellSerializer. The class extends ObjectInputStream but delegates incoming readObject() requests to a private ObjectInputStream.

Reading DataCell using a DataCellSerializer is done using the readDataCell() method. It will use another input stream that delegates itself to the private ObjectInputStream but uses blocks to determine the end of a DataCell. An attempt to summarize the different streams is made in the following figure (for the output stream though).

Streams


Nested Class Summary
 
Nested classes/interfaces inherited from class java.io.ObjectInputStream
ObjectInputStream.GetField
 
Field Summary
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
DCObjectInputStream(InputStream in)
          Creates new input stream that reads from in.
 
Method Summary
 int available()
          
 void close()
          
 void defaultReadObject()
          
 void mark(int readlimit)
          
 boolean markSupported()
          
 int read()
          
 int read(byte[] b)
          
 int read(byte[] buf, int off, int len)
          
 BlobDataCell.BlobAddress readBlobAddress()
          Reads a blob address from the stream and ends the block.
 boolean readBoolean()
          
 byte readByte()
          
 char readChar()
          
 DataCell readDataCell(DataCellSerializer<? extends DataCell> serializer)
          Reads a data cell from the stream and pushes the stream forward to the end of the block.
 double readDouble()
          
 ObjectInputStream.GetField readFields()
          
 float readFloat()
          
 void readFully(byte[] buf)
          
 void readFully(byte[] buf, int off, int len)
          
 int readInt()
          
 long readLong()
          
protected  Object readObjectOverride()
          
 short readShort()
          
 Object readUnshared()
          
 int readUnsignedByte()
          
 int readUnsignedShort()
          
 String readUTF()
          
 void registerValidation(ObjectInputValidation obj, int prio)
          
 void reset()
          
(package private)  void setCurrentClassLoader(ClassLoader l)
          Set the class loader to ask "first" to load classes.
 long skip(long n)
          
 int skipBytes(int len)
          
 String toString()
          
 
Methods inherited from class java.io.ObjectInputStream
enableResolveObject, readClassDescriptor, readLine, readObject, readStreamHeader, resolveClass, resolveObject, resolveProxyClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DCObjectInputStream

DCObjectInputStream(InputStream in)
              throws IOException
Creates new input stream that reads from in.

Parameters:
in - The stream to read from.
Throws:
IOException - If the init of the stream reading fails.
Method Detail

readDataCell

public DataCell readDataCell(DataCellSerializer<? extends DataCell> serializer)
                      throws IOException
Reads a data cell from the stream and pushes the stream forward to the end of the block.

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)

readBlobAddress

public BlobDataCell.BlobAddress readBlobAddress()
                                         throws IOException
Reads a blob address from the stream and ends the block.

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

available

public int available()
              throws IOException

Specified by:
available in interface ObjectInput
Overrides:
available in class ObjectInputStream
Throws:
IOException

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Specified by:
close in interface ObjectInput
Overrides:
close in class ObjectInputStream
Throws:
IOException

defaultReadObject

public void defaultReadObject()
                       throws IOException,
                              ClassNotFoundException

Overrides:
defaultReadObject in class ObjectInputStream
Throws:
IOException
ClassNotFoundException

mark

public void mark(int readlimit)

Overrides:
mark in class InputStream

markSupported

public boolean markSupported()

Overrides:
markSupported in class InputStream

read

public int read()
         throws IOException

Specified by:
read in interface ObjectInput
Overrides:
read in class ObjectInputStream
Throws:
IOException

read

public int read(byte[] buf,
                int off,
                int len)
         throws IOException

Specified by:
read in interface ObjectInput
Overrides:
read in class ObjectInputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException

Specified by:
read in interface ObjectInput
Overrides:
read in class InputStream
Throws:
IOException

readBoolean

public boolean readBoolean()
                    throws IOException

Specified by:
readBoolean in interface DataInput
Overrides:
readBoolean in class ObjectInputStream
Throws:
IOException

readByte

public byte readByte()
              throws IOException

Specified by:
readByte in interface DataInput
Overrides:
readByte in class ObjectInputStream
Throws:
IOException

readChar

public char readChar()
              throws IOException

Specified by:
readChar in interface DataInput
Overrides:
readChar in class ObjectInputStream
Throws:
IOException

readDouble

public double readDouble()
                  throws IOException

Specified by:
readDouble in interface DataInput
Overrides:
readDouble in class ObjectInputStream
Throws:
IOException

readFields

public ObjectInputStream.GetField readFields()
                                      throws IOException,
                                             ClassNotFoundException

Overrides:
readFields in class ObjectInputStream
Throws:
IOException
ClassNotFoundException

readFloat

public float readFloat()
                throws IOException

Specified by:
readFloat in interface DataInput
Overrides:
readFloat in class ObjectInputStream
Throws:
IOException

readFully

public void readFully(byte[] buf,
                      int off,
                      int len)
               throws IOException

Specified by:
readFully in interface DataInput
Overrides:
readFully in class ObjectInputStream
Throws:
IOException

readFully

public void readFully(byte[] buf)
               throws IOException

Specified by:
readFully in interface DataInput
Overrides:
readFully in class ObjectInputStream
Throws:
IOException

readInt

public int readInt()
            throws IOException

Specified by:
readInt in interface DataInput
Overrides:
readInt in class ObjectInputStream
Throws:
IOException

readLong

public long readLong()
              throws IOException

Specified by:
readLong in interface DataInput
Overrides:
readLong in class ObjectInputStream
Throws:
IOException

readObjectOverride

protected Object readObjectOverride()
                             throws IOException,
                                    ClassNotFoundException

Overrides:
readObjectOverride in class ObjectInputStream
Throws:
IOException
ClassNotFoundException

readShort

public short readShort()
                throws IOException

Specified by:
readShort in interface DataInput
Overrides:
readShort in class ObjectInputStream
Throws:
IOException

readUnshared

public Object readUnshared()
                    throws IOException,
                           ClassNotFoundException

Overrides:
readUnshared in class ObjectInputStream
Throws:
IOException
ClassNotFoundException

readUnsignedByte

public int readUnsignedByte()
                     throws IOException

Specified by:
readUnsignedByte in interface DataInput
Overrides:
readUnsignedByte in class ObjectInputStream
Throws:
IOException

readUnsignedShort

public int readUnsignedShort()
                      throws IOException

Specified by:
readUnsignedShort in interface DataInput
Overrides:
readUnsignedShort in class ObjectInputStream
Throws:
IOException

readUTF

public String readUTF()
               throws IOException

Specified by:
readUTF in interface DataInput
Overrides:
readUTF in class ObjectInputStream
Throws:
IOException

registerValidation

public void registerValidation(ObjectInputValidation obj,
                               int prio)
                        throws NotActiveException,
                               InvalidObjectException

Overrides:
registerValidation in class ObjectInputStream
Throws:
NotActiveException
InvalidObjectException

reset

public void reset()
           throws IOException

Overrides:
reset in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException

Specified by:
skip in interface ObjectInput
Overrides:
skip in class InputStream
Throws:
IOException

skipBytes

public int skipBytes(int len)
              throws IOException

Specified by:
skipBytes in interface DataInput
Overrides:
skipBytes in class ObjectInputStream
Throws:
IOException

toString

public String toString()

Overrides:
toString in class Object

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)


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.