org.jboss.cache.marshall.io
Class ReusableObjectInputStream
java.lang.Object
java.io.InputStream
java.io.ObjectInputStream
org.jboss.util.stream.MarshalledValueInputStream
org.jboss.cache.marshall.io.ReusableObjectInputStream
- All Implemented Interfaces:
- Closeable, DataInput, ObjectInput, ObjectStreamConstants
public class ReusableObjectInputStream
- extends org.jboss.util.stream.MarshalledValueInputStream
A reusable ObjectInputStream that uses an internal byte array. The byte array can be set using init(byte[])
,
objects read from the byte array, and the stream reset using reset()
.
These features allow the stream to be reused and pooled.
- Since:
- 2.1.0
- Author:
- Manik Surtani (manik@jboss.org)
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 |
Method Summary |
void |
init(byte[] buf)
Initialises the stream to read from the byte buffer passed in |
void |
reset()
Resets the ObjectInputStream so it can be reused, by resetting and clearing any internal caches and by clearing the
underlying byte stream to free up memory. |
Methods inherited from class org.jboss.util.stream.MarshalledValueInputStream |
resolveClass, resolveProxyClass |
Methods inherited from class java.io.ObjectInputStream |
available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readChar, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, skipBytes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INIT_BYTES
public static final byte[] INIT_BYTES
ReusableObjectInputStream
public ReusableObjectInputStream()
throws IOException,
SecurityException
- Throws:
IOException
SecurityException
ReusableObjectInputStream
protected ReusableObjectInputStream(org.jboss.cache.marshall.io.ReusableObjectInputStream.ResettableByteArrayInputStream in)
throws IOException
- Throws:
IOException
reset
public void reset()
throws IOException
- Resets the ObjectInputStream so it can be reused, by resetting and clearing any internal caches and by clearing the
underlying byte stream to free up memory.
- Overrides:
reset
in class InputStream
- Throws:
IOException
init
public void init(byte[] buf)
throws IOException
- Initialises the stream to read from the byte buffer passed in
- Parameters:
buf
- byte buffer to read from
- Throws:
IOException
Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.