Package org.jboss.marshalling.serial
Class SerialUnmarshaller
- java.lang.Object
-
- java.io.InputStream
-
- org.jboss.marshalling.SimpleByteInput
-
- org.jboss.marshalling.ByteInputStream
-
- org.jboss.marshalling.SimpleDataInput
-
- org.jboss.marshalling.AbstractObjectInput
-
- org.jboss.marshalling.AbstractUnmarshaller
-
- org.jboss.marshalling.serial.SerialUnmarshaller
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataInput,java.io.ObjectInput,java.io.ObjectStreamConstants,java.lang.AutoCloseable,ByteInput,ExtendedObjectStreamConstants,Unmarshaller
public final class SerialUnmarshaller extends AbstractUnmarshaller implements Unmarshaller, ExtendedObjectStreamConstants
-
-
Field Summary
Fields Modifier and Type Field Description private BlockUnmarshallerblockUnmarshallerprivate java.security.PrivilegedExceptionAction<SerialObjectInputStream>createObjectOutputStreamActionprivate intdepthprivate static int[]EMPTY_INTSprivate static java.lang.String[]EMPTY_STRINGSprivate java.util.ArrayList<java.lang.Object>instanceCacheprivate SerialObjectInputStreamoisprivate SerializableClassRegistryregistryprivate static java.lang.ObjectUNRESOLVEDprivate static java.lang.ObjectUNSHAREDprivate java.util.SortedMap<java.lang.Integer,java.util.Set<java.io.ObjectInputValidation>>validationMapprivate intversion-
Fields inherited from class org.jboss.marshalling.AbstractUnmarshaller
classExternalizerFactory, classResolver, classTable, configuredVersion, exceptionListener, objectPreResolver, objectResolver, objectTable, serializabilityChecker, streamHeader
-
Fields inherited from class org.jboss.marshalling.SimpleDataInput
buffer, limit, position
-
Fields inherited from class org.jboss.marshalling.ByteInputStream
byteInput
-
Fields inherited from interface org.jboss.marshalling.serial.ExtendedObjectStreamConstants
TC_CLASSTABLEDESC, TC_OBJECTTABLE
-
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 Constructor Description SerialUnmarshaller(SerialMarshallerFactory factory, SerializableClassRegistry registry, MarshallingConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddValidation(java.io.ObjectInputValidation validation, int prio)private java.io.StreamCorruptedExceptionbadLeadByte(int leadByte)private Descriptorbridge(Descriptor descriptor, java.lang.Class<?> type)voidclearClassCache()Discard the class cache.voidclearInstanceCache()Discard the instance cache.voidclose()private SerialObjectInputStreamcreateObjectInputStream()DescriptordescriptorForClass(java.lang.Class<?> clazz)protected java.lang.ObjectdoReadObject(boolean unshared)Implementation of the actual object-reading method.(package private) java.lang.ObjectdoReadObject(int leadByte, boolean unshared)private voiddoReadSerialObject(Descriptor descriptor, java.lang.Object obj)(package private) java.lang.StringdoReadString()voidfinish()Finish reading from the current input.(package private) BlockUnmarshallergetBlockUnmarshaller()(package private) SerialObjectInputStreamgetObjectInputStream()private static java.io.InvalidClassExceptionobjectStreamClassException()(package private) java.lang.ObjectreadBackReference(int handle)private DescriptorreadClassDescriptor(boolean required)private DescriptorreadClassDescriptor(int leadByte, boolean required)private DescriptorreadNonNullClassDescriptor()private java.lang.ObjectreplaceOrReturn(boolean unshared, java.lang.Object object)private java.lang.ObjectreplaceOrReturn(boolean unshared, java.lang.Object object, int idx)voidstart(ByteInput byteInput)Start reading from the given input.-
Methods inherited from class org.jboss.marshalling.AbstractObjectInput
readObject, readObject, readObjectUnshared, readObjectUnshared
-
Methods inherited from class org.jboss.marshalling.SimpleDataInput
available, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readIntDirect, readLine, readLong, readLongDirect, readShort, readUnsignedByte, readUnsignedByteDirect, readUnsignedShort, readUTF, skip, skipBytes
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
Methods inherited from interface org.jboss.marshalling.Unmarshaller
readObject, readObjectUnshared, readObjectUnshared
-
-
-
-
Field Detail
-
UNSHARED
private static final java.lang.Object UNSHARED
-
UNRESOLVED
private static final java.lang.Object UNRESOLVED
-
instanceCache
private final java.util.ArrayList<java.lang.Object> instanceCache
-
registry
private final SerializableClassRegistry registry
-
depth
private int depth
-
ois
private SerialObjectInputStream ois
-
blockUnmarshaller
private BlockUnmarshaller blockUnmarshaller
-
version
private int version
-
EMPTY_INTS
private static final int[] EMPTY_INTS
-
EMPTY_STRINGS
private static final java.lang.String[] EMPTY_STRINGS
-
createObjectOutputStreamAction
private final java.security.PrivilegedExceptionAction<SerialObjectInputStream> createObjectOutputStreamAction
-
validationMap
private final java.util.SortedMap<java.lang.Integer,java.util.Set<java.io.ObjectInputValidation>> validationMap
-
-
Constructor Detail
-
SerialUnmarshaller
SerialUnmarshaller(SerialMarshallerFactory factory, SerializableClassRegistry registry, MarshallingConfiguration configuration)
-
-
Method Detail
-
doReadObject
protected java.lang.Object doReadObject(boolean unshared) throws java.lang.ClassNotFoundException, java.io.IOExceptionDescription copied from class:AbstractObjectInputImplementation of the actual object-reading method.- Specified by:
doReadObjectin classAbstractObjectInput- Parameters:
unshared-trueif the instance should be unshared,falseif it is shared- Returns:
- the object to read
- Throws:
java.lang.ClassNotFoundException- if the class for the object could not be loadedjava.io.IOException- if an I/O error occurs
-
doReadString
java.lang.String doReadString() throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
readBackReference
java.lang.Object readBackReference(int handle) throws java.io.IOException- Throws:
java.io.IOException
-
doReadObject
java.lang.Object doReadObject(int leadByte, boolean unshared) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
doReadSerialObject
private void doReadSerialObject(Descriptor descriptor, java.lang.Object obj) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundExceptionjava.io.IOException
-
objectStreamClassException
private static java.io.InvalidClassException objectStreamClassException()
-
readNonNullClassDescriptor
private Descriptor readNonNullClassDescriptor() throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundExceptionjava.io.IOException
-
readClassDescriptor
private Descriptor readClassDescriptor(boolean required) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundExceptionjava.io.IOException
-
readClassDescriptor
private Descriptor readClassDescriptor(int leadByte, boolean required) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
bridge
private Descriptor bridge(Descriptor descriptor, java.lang.Class<?> type)
-
badLeadByte
private java.io.StreamCorruptedException badLeadByte(int leadByte)
-
clearInstanceCache
public void clearInstanceCache() throws java.io.IOExceptionDescription copied from interface:UnmarshallerDiscard the instance cache.- Specified by:
clearInstanceCachein interfaceUnmarshaller- Throws:
java.io.IOException- if an error occurs
-
clearClassCache
public void clearClassCache() throws java.io.IOExceptionDescription copied from interface:UnmarshallerDiscard the class cache. Implicitly also discards the instance cache.- Specified by:
clearClassCachein interfaceUnmarshaller- Throws:
java.io.IOException- if an error occurs
-
start
public void start(ByteInput byteInput) throws java.io.IOException
Description copied from class:AbstractUnmarshallerStart reading from the given input. The internal buffer is discarded.- Specified by:
startin interfaceUnmarshaller- Overrides:
startin classAbstractUnmarshaller- Parameters:
byteInput- the new input from which to read- Throws:
java.io.IOException- not thrown by this implementation, but may be overridden to be thrown if a problem occurs
-
finish
public void finish() throws java.io.IOExceptionDescription copied from class:AbstractUnmarshallerFinish reading from the current input. The internal buffer is discarded, not flushed.- Specified by:
finishin interfaceUnmarshaller- Overrides:
finishin classAbstractUnmarshaller- Throws:
java.io.IOException- not thrown by this implementation, but may be overridden to be thrown if a problem occurs
-
close
public void close() throws java.io.IOExceptionDescription copied from class:SimpleDataInput- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.io.ObjectInput- Overrides:
closein classSimpleDataInput- Throws:
java.io.IOException
-
getBlockUnmarshaller
BlockUnmarshaller getBlockUnmarshaller()
-
createObjectInputStream
private SerialObjectInputStream createObjectInputStream() throws java.io.IOException
- Throws:
java.io.IOException
-
getObjectInputStream
SerialObjectInputStream getObjectInputStream() throws java.io.IOException
- Throws:
java.io.IOException
-
addValidation
void addValidation(java.io.ObjectInputValidation validation, int prio)
-
descriptorForClass
public Descriptor descriptorForClass(java.lang.Class<?> clazz)
-
replaceOrReturn
private java.lang.Object replaceOrReturn(boolean unshared, java.lang.Object object)
-
replaceOrReturn
private java.lang.Object replaceOrReturn(boolean unshared, java.lang.Object object, int idx)
-
-