public class MarshalInputStream extends AnnotatedObjectInputStream
AnnotatedObjectInputStream
that provides local storage of already
resolved class descriptors, to optimize the marshaling.Modifier and Type | Class and Description |
---|---|
static class |
MarshalInputStream.Context |
ObjectInputStream.GetField
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 and Description |
---|
MarshalInputStream(InputStream in) |
MarshalInputStream(InputStream in,
MarshalInputStream.Context context) |
Modifier and Type | Method and Description |
---|---|
void |
closeContext() |
static MarshalInputStream.Context |
createContext() |
protected String |
readAnnotation(ObjectStreamClass desc)
Reads and returns a class annotation string value (possibly
null ) that was
written by a corresponding AnnotatedObjectOutputStream implementation. |
protected ObjectStreamClass |
readClassDescriptor()
Overrides the super method and tries to get the class descriptor from a local map.
|
Object |
readRepetitiveObject()
Reads a repetitive object which was written by
MarshalOutputStream.writeRepetitiveObject(java.lang.Object) . |
Object |
readSmartExternalizable() |
protected void |
readStreamHeader() |
void |
resetContext() |
protected Class<?> |
resolveClass(ObjectStreamClass classDesc)
Resolves the appropriate
Class object for the stream class descriptor
classDesc . |
protected Class<?> |
resolveProxyClass(String[] interfaceNames)
Resolves the appropriate
Class object for the proxy class described by the interface
names interfaceNames . |
resolveClass
available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, skipBytes
mark, markSupported, read, reset, skip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
read, skip
public MarshalInputStream(InputStream in) throws IOException
in
- input stream to wrap.IOException
public MarshalInputStream(InputStream in, MarshalInputStream.Context context) throws IOException
IOException
public static MarshalInputStream.Context createContext()
public Object readRepetitiveObject() throws IOException, ClassNotFoundException
MarshalOutputStream.writeRepetitiveObject(java.lang.Object)
.IOException
ClassNotFoundException
public Object readSmartExternalizable() throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException
Class
object for the stream class descriptor
classDesc
.
MarshalInputStream
implements this method as follows:
First tries to check if this class descriptor was already resolved if it does return the class.
Else invokes the super class implementation.
resolveClass
in class AnnotatedObjectInputStream
classDesc
- the stream class descriptor to resolveIOException
- if readAnnotation
throws an IOException
,
or if ClassLoading.loadClass
throws a
MalformedURLException
ClassNotFoundException
- if readAnnotation
or ClassLoading.loadClass
throws a ClassNotFoundException
NullPointerException
- if classDesc
is null
protected String readAnnotation(ObjectStreamClass desc) throws IOException, ClassNotFoundException
AnnotatedObjectInputStream
null
) that was
written by a corresponding AnnotatedObjectOutputStream
implementation.
AnnotatedObjectInputStream
implements this method to just read the annotation
value from this stream using readUnshared
, and if
readUnshared
returns a non-null
value that is not a
String
, an InvalidObjectException
is thrown.
A subclass can override this method to read the annotation from a different location.
readAnnotation
in class AnnotatedObjectInputStream
null
)IOException
- if an I/O exception occurs reading the annotationClassNotFoundException
- if a ClassNotFoundException
occurs reading the
annotationprotected Class<?> resolveProxyClass(String[] interfaceNames) throws IOException, ClassNotFoundException
Class
object for the proxy class described by the interface
names interfaceNames
.
MarshalInputStream
implements this method as follows:
First tries to check if this class descriptor was already resolved if it does return the class.
Else invokes the super class implementation
resolveProxyClass
in class ObjectInputStream
interfaceNames
- the list of interface names that were deserialized in the proxy class
descriptorIOException
- if readAnnotation
throws an IOException
,
or if ClassLoading.loadProxyClass
throws a
MalformedURLException
ClassNotFoundException
- if readAnnotation
or ClassLoading.loadProxyClass
throws a ClassNotFoundException
NullPointerException
- if interfaceNames
is null
or if any
element of interfaceNames
is null
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException
readClassDescriptor
in class ObjectInputStream
IOException
ClassNotFoundException
protected void readStreamHeader() throws IOException
readStreamHeader
in class ObjectInputStream
IOException
public void closeContext()
public void resetContext()
Copyright © GigaSpaces.