Package org.jboss.marshalling
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:
java.io.Closeable,java.io.DataInput,java.io.ObjectInput,java.lang.AutoCloseable,ByteInput
- Direct Known Subclasses:
AbstractUnmarshaller,SerializingCloner.StepObjectInput
public abstract class AbstractObjectInput extends SimpleDataInput implements java.io.ObjectInput
An abstract object input implementation.
-
-
Field Summary
-
Fields inherited from class org.jboss.marshalling.SimpleDataInput
buffer, limit, position
-
Fields inherited from class org.jboss.marshalling.ByteInputStream
byteInput
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractObjectInput(int bufferSize)Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.ObjectdoReadObject(boolean unshared)Implementation of the actual object-reading method.java.lang.ObjectreadObject()<T> TreadObject(java.lang.Class<T> type)Read and return an object, cast to a specific type.java.lang.ObjectreadObjectUnshared()Read and return an unshared object.<T> TreadObjectUnshared(java.lang.Class<T> type)Read and return an unshared object, cast to a specific type.private static java.io.InvalidObjectExceptionwrongType(java.lang.ClassCastException e, java.lang.Class<?> expected, java.lang.Class<?> actual)-
Methods inherited from class org.jboss.marshalling.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, start
-
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
-
-
-
-
Method Detail
-
readObject
public final java.lang.Object readObject() throws java.lang.ClassNotFoundException, java.io.IOException- Specified by:
readObjectin interfacejava.io.ObjectInput- Throws:
java.lang.ClassNotFoundExceptionjava.io.IOException
-
readObjectUnshared
public final java.lang.Object readObjectUnshared() throws java.lang.ClassNotFoundException, java.io.IOExceptionRead and return an unshared object.- Returns:
- an unshared object
- Throws:
java.lang.ClassNotFoundException- if the class of a serialized object cannot be foundjava.io.IOException- if an error occurs
-
doReadObject
protected abstract java.lang.Object doReadObject(boolean unshared) throws java.lang.ClassNotFoundException, java.io.IOExceptionImplementation of the actual object-reading method.- 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
-
readObject
public <T> T readObject(java.lang.Class<T> type) throws java.lang.ClassNotFoundException, java.io.IOExceptionRead 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:
java.lang.ClassNotFoundException- if the class of a serialized object cannot be foundjava.io.InvalidObjectException- if the object is not of the expected typejava.io.IOException- if an error occurs
-
readObjectUnshared
public <T> T readObjectUnshared(java.lang.Class<T> type) throws java.lang.ClassNotFoundException, java.io.IOExceptionRead and return an unshared object, cast to a specific type.- Type Parameters:
T- the object type- Parameters:
type- the object class- Returns:
- an unshared object
- Throws:
java.lang.ClassNotFoundException- if the class of a serialized object cannot be foundjava.io.InvalidObjectException- if the object is not of the expected typejava.io.IOException- if an error occurs
-
wrongType
private static java.io.InvalidObjectException wrongType(java.lang.ClassCastException e, java.lang.Class<?> expected, java.lang.Class<?> actual)
-
-