Package com.gigaspaces.internal.io
Class MarshalInputStream
java.lang.Object
java.io.InputStream
java.io.ObjectInputStream
com.gigaspaces.internal.io.AnnotatedObjectInputStream
com.gigaspaces.internal.io.MarshalInputStream
- All Implemented Interfaces:
Closeable,DataInput,ObjectInput,ObjectStreamConstants,AutoCloseable
An extension of
AnnotatedObjectInputStream that provides local storage of already
resolved class descriptors, to optimize the marshaling.- Since:
- 5.0
- Author:
- Igor Goldenberg, anna
-
Nested Class Summary
Nested ClassesNested 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, SERIAL_FILTER_PERMISSION, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic MarshalInputStream.Contextprotected StringReads and returns a class annotation string value (possiblynull) that was written by a correspondingAnnotatedObjectOutputStreamimplementation.protected ObjectStreamClassOverrides the super method and tries to get the class descriptor from a local map.Reads a repetitive object which was written byMarshalOutputStream.writeRepetitiveObject(java.lang.Object).protected voidvoidprotected Class<?>resolveClass(ObjectStreamClass classDesc) Resolves the appropriateClassobject for the stream class descriptorclassDesc.protected Class<?>resolveProxyClass(String[] interfaceNames) Resolves the appropriateClassobject for the proxy class described by the interface namesinterfaceNames.Methods inherited from class com.gigaspaces.internal.io.AnnotatedObjectInputStream
resolveClassMethods inherited from class java.io.ObjectInputStream
available, close, defaultReadObject, enableResolveObject, getObjectInputFilter, read, read, readBoolean, readByte, readChar, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, setObjectInputFilter, skipBytesMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferToMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.io.ObjectInput
read, skip
-
Constructor Details
-
MarshalInputStream
- Parameters:
in- input stream to wrap.- Throws:
IOException
-
MarshalInputStream
- Throws:
IOException
-
-
Method Details
-
createContext
-
readRepetitiveObject
Reads a repetitive object which was written byMarshalOutputStream.writeRepetitiveObject(java.lang.Object).- Throws:
IOExceptionClassNotFoundException
-
readSmartExternalizable
- Throws:
IOExceptionClassNotFoundException
-
resolveClass
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException Resolves the appropriateClassobject for the stream class descriptorclassDesc.MarshalInputStreamimplements 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.
- Overrides:
resolveClassin classAnnotatedObjectInputStream- Parameters:
classDesc- the stream class descriptor to resolve- Returns:
- the resolved class
- Throws:
IOException- ifreadAnnotationthrows anIOException, or ifClassLoading.loadClassthrows aMalformedURLExceptionClassNotFoundException- ifreadAnnotationorClassLoading.loadClassthrows aClassNotFoundExceptionNullPointerException- ifclassDescisnull
-
readAnnotation
Description copied from class:AnnotatedObjectInputStreamReads and returns a class annotation string value (possiblynull) that was written by a correspondingAnnotatedObjectOutputStreamimplementation.AnnotatedObjectInputStreamimplements this method to just read the annotation value from this stream usingreadUnshared, and ifreadUnsharedreturns a non-nullvalue that is not aString, anInvalidObjectExceptionis thrown.A subclass can override this method to read the annotation from a different location.
- Overrides:
readAnnotationin classAnnotatedObjectInputStream- Returns:
- the class annotation string value read (possibly
null) - Throws:
IOException- if an I/O exception occurs reading the annotationClassNotFoundException- if aClassNotFoundExceptionoccurs reading the annotation
-
resolveProxyClass
protected Class<?> resolveProxyClass(String[] interfaceNames) throws IOException, ClassNotFoundException Resolves the appropriateClassobject for the proxy class described by the interface namesinterfaceNames.MarshalInputStreamimplements 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
- Overrides:
resolveProxyClassin classObjectInputStream- Parameters:
interfaceNames- the list of interface names that were deserialized in the proxy class descriptor- Returns:
- the resolved dynamic proxy class
- Throws:
IOException- ifreadAnnotationthrows anIOException, or ifClassLoading.loadProxyClassthrows aMalformedURLExceptionClassNotFoundException- ifreadAnnotationorClassLoading.loadProxyClassthrows aClassNotFoundExceptionNullPointerException- ifinterfaceNamesisnullor if any element ofinterfaceNamesisnull
-
readClassDescriptor
Overrides the super method and tries to get the class descriptor from a local map. If not found read from the stream and save to local map.- Overrides:
readClassDescriptorin classObjectInputStream- Returns:
- class descriptor
- Throws:
IOExceptionClassNotFoundException
-
readStreamHeader
- Overrides:
readStreamHeaderin classObjectInputStream- Throws:
IOException
-
closeContext
public void closeContext() -
resetContext
public void resetContext()
-