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 BlockUnmarshaller
blockUnmarshaller
private java.security.PrivilegedExceptionAction<SerialObjectInputStream>
createObjectOutputStreamAction
private int
depth
private static int[]
EMPTY_INTS
private static java.lang.String[]
EMPTY_STRINGS
private java.util.ArrayList<java.lang.Object>
instanceCache
private SerialObjectInputStream
ois
private SerializableClassRegistry
registry
private static java.lang.Object
UNRESOLVED
private static java.lang.Object
UNSHARED
private java.util.SortedMap<java.lang.Integer,java.util.Set<java.io.ObjectInputValidation>>
validationMap
private int
version
-
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) void
addValidation(java.io.ObjectInputValidation validation, int prio)
private java.io.StreamCorruptedException
badLeadByte(int leadByte)
private Descriptor
bridge(Descriptor descriptor, java.lang.Class<?> type)
void
clearClassCache()
Discard the class cache.void
clearInstanceCache()
Discard the instance cache.void
close()
private SerialObjectInputStream
createObjectInputStream()
Descriptor
descriptorForClass(java.lang.Class<?> clazz)
protected java.lang.Object
doReadObject(boolean unshared)
Implementation of the actual object-reading method.(package private) java.lang.Object
doReadObject(int leadByte, boolean unshared)
private void
doReadSerialObject(Descriptor descriptor, java.lang.Object obj)
(package private) java.lang.String
doReadString()
void
finish()
Finish reading from the current input.(package private) BlockUnmarshaller
getBlockUnmarshaller()
(package private) SerialObjectInputStream
getObjectInputStream()
private static java.io.InvalidClassException
objectStreamClassException()
(package private) java.lang.Object
readBackReference(int handle)
private Descriptor
readClassDescriptor(boolean required)
private Descriptor
readClassDescriptor(int leadByte, boolean required)
private Descriptor
readNonNullClassDescriptor()
private java.lang.Object
replaceOrReturn(boolean unshared, java.lang.Object object)
private java.lang.Object
replaceOrReturn(boolean unshared, java.lang.Object object, int idx)
void
start(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.IOException
Description copied from class:AbstractObjectInput
Implementation of the actual object-reading method.- Specified by:
doReadObject
in classAbstractObjectInput
- Parameters:
unshared
-true
if the instance should be unshared,false
if 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.IOException
java.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.IOException
java.lang.ClassNotFoundException
-
doReadSerialObject
private void doReadSerialObject(Descriptor descriptor, java.lang.Object obj) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
objectStreamClassException
private static java.io.InvalidClassException objectStreamClassException()
-
readNonNullClassDescriptor
private Descriptor readNonNullClassDescriptor() throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
readClassDescriptor
private Descriptor readClassDescriptor(boolean required) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
readClassDescriptor
private Descriptor readClassDescriptor(int leadByte, boolean required) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.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.IOException
Description copied from interface:Unmarshaller
Discard the instance cache.- Specified by:
clearInstanceCache
in interfaceUnmarshaller
- Throws:
java.io.IOException
- if an error occurs
-
clearClassCache
public void clearClassCache() throws java.io.IOException
Description copied from interface:Unmarshaller
Discard the class cache. Implicitly also discards the instance cache.- Specified by:
clearClassCache
in interfaceUnmarshaller
- Throws:
java.io.IOException
- if an error occurs
-
start
public void start(ByteInput byteInput) throws java.io.IOException
Description copied from class:AbstractUnmarshaller
Start reading from the given input. The internal buffer is discarded.- Specified by:
start
in interfaceUnmarshaller
- Overrides:
start
in 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.IOException
Description copied from class:AbstractUnmarshaller
Finish reading from the current input. The internal buffer is discarded, not flushed.- Specified by:
finish
in interfaceUnmarshaller
- Overrides:
finish
in 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.IOException
Description copied from class:SimpleDataInput
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejava.io.ObjectInput
- Overrides:
close
in 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)
-
-