Class AbstractObjectInput
java.lang.Object
java.io.InputStream
org.jboss.marshalling.SimpleByteInput
org.jboss.marshalling.ByteInputStream
org.jboss.marshalling.SimpleDataInput
org.jboss.marshalling.AbstractObjectInput
- All Implemented Interfaces:
Closeable, DataInput, ObjectInput, AutoCloseable, ByteInput
- Direct Known Subclasses:
AbstractUnmarshaller, SerializingCloner.StepObjectInput
An abstract object input implementation.
-
Field Summary
Fields inherited from class SimpleDataInput
buffer, limit, positionFields inherited from class ByteInputStream
byteInput -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractObjectInput(int bufferSize) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ObjectdoReadObject(boolean unshared) Implementation of the actual object-reading method.final Object<T> TreadObject(Class<T> type) Read and return an object, cast to a specific type.final ObjectRead and return an unshared object.<T> TreadObjectUnshared(Class<T> type) Read and return an unshared object, cast to a specific type.private static InvalidObjectExceptionwrongType(ClassCastException e, Class<?> expected, Class<?> actual) Methods inherited from class SimpleDataInput
available, close, finish, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readIntDirect, readLine, readLong, readLongDirect, readShort, readUnsignedByte, readUnsignedByteDirect, readUnsignedShort, readUTF, skip, skipBytes, startMethods inherited from class InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferToMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
Constructor Details
-
AbstractObjectInput
protected AbstractObjectInput(int bufferSize) Construct a new instance.- Parameters:
bufferSize- the buffer size to use
-
-
Method Details
-
readObject
- Specified by:
readObjectin interfaceObjectInput- Throws:
ClassNotFoundExceptionIOException
-
doReadObject
Implementation of the actual object-reading method.- Parameters:
unshared-trueif the instance should be unshared,falseif it is shared- Returns:
- the object to read
- Throws:
ClassNotFoundException- if the class for the object could not be loadedIOException- if an I/O error occurs
-
readObject
Read and return an object, cast to a specific type.- Type Parameters:
T- the object type- Parameters:
type- the object class- Returns:
- the object read from the stream
- Throws:
ClassNotFoundException- if the class of a serialized object cannot be foundInvalidObjectException- if the object is not of the expected typeIOException- if an error occurs
-
wrongType
private static InvalidObjectException wrongType(ClassCastException e, Class<?> expected, Class<?> actual)
-