Top Description Fields Constructors Methods
org.jboss.marshalling

public abstract Class AbstractObjectInput

extends SimpleDataInput
implements ObjectInput
Class Inheritance
All Implemented Interfaces
java.io.ObjectInput, java.lang.AutoCloseable, java.io.DataInput
Known Direct Subclasses
org.jboss.marshalling.AbstractUnmarshaller, org.jboss.marshalling.cloner.SerializingCloner.StepObjectInput
Imports
java.io.IOException, .InvalidObjectException, .ObjectInput

An abstract object input implementation.

Field Summary

Inherited from org.jboss.marshalling.SimpleDataInput:
bufferlimitposition

Constructor Summary

AccessConstructor and Description
protected
AbstractObjectInput(int
the buffer size to use
bufferSize
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
protected abstract Object

Returns:

the object to read
doReadObject
(boolean
true if the instance should be unshared, false if it is shared
unshared
)

Implementation of the actual object-reading method.

public final Object
readObject()

Implements java.io.ObjectInput.readObject.

Read and return an object.
public <
the object type
T
>
T

Returns:

the object read from the stream
readObject
(final Class<T>
the object class
type
)

Read and return an object, cast to a specific type.

public final Object

Returns:

an unshared object
readObjectUnshared
()

Read and return an unshared object.

public <
the object type
T
>
T

Returns:

an unshared object
readObjectUnshared
(final Class<T>
the object class
type
)

Read and return an unshared object, cast to a specific type.

private static InvalidObjectException
wrongType(final ClassCastException e, final Class<?> expected, final Class<?> actual)

Inherited from org.jboss.marshalling.SimpleDataInput:
availableclosefinishreadreadreadreadBooleanreadBytereadCharreadDoublereadFloatreadFullyreadFullyreadIntreadIntDirectreadLinereadLongreadLongDirectreadShortreadUnsignedBytereadUnsignedByteDirectreadUnsignedShortreadUTFskipskipBytesstart

Constructor Detail

AbstractObjectInputback to summary
protected AbstractObjectInput(int bufferSize)

Construct a new instance.

Parameters
bufferSize:int

the buffer size to use

Method Detail

doReadObjectback to summary
protected abstract Object doReadObject(boolean unshared) throws ClassNotFoundException, IOException

Implementation of the actual object-reading method.

Parameters
unshared:boolean

true if the instance should be unshared, false if it is shared

Returns:Object

the object to read

Exceptions
ClassNotFoundException:
if the class for the object could not be loaded
IOException:
if an I/O error occurs
readObjectback to summary
public final Object readObject() throws ClassNotFoundException, IOException

Implements java.io.ObjectInput.readObject.

Doc from java.io.ObjectInput.readObject.

Read and return an object. The class that implements this interface defines where the object is "read" from.

Returns:Object

the object read from the stream

Exceptions
ClassNotFoundException:
If the class of a serialized object cannot be found.
IOException:
If any of the usual Input/Output related exceptions occur.
readObjectback to summary
public <T> T readObject(final Class<T> type) throws ClassNotFoundException, IOException

Read and return an object, cast to a specific type.

Parameters
<T>
the object type
type:Class<T>

the object class

Returns:T

the object read from the stream

Exceptions
ClassNotFoundException:
if the class of a serialized object cannot be found
IOException:
if an error occurs
InvalidObjectException:
if the object is not of the expected type
readObjectUnsharedback to summary
public final Object readObjectUnshared() throws ClassNotFoundException, IOException

Read and return an unshared object.

Returns:Object

an unshared object

Exceptions
ClassNotFoundException:
if the class of a serialized object cannot be found
IOException:
if an error occurs
readObjectUnsharedback to summary
public <T> T readObjectUnshared(final Class<T> type) throws ClassNotFoundException, IOException

Read and return an unshared object, cast to a specific type.

Parameters
<T>
the object type
type:Class<T>

the object class

Returns:T

an unshared object

Exceptions
ClassNotFoundException:
if the class of a serialized object cannot be found
IOException:
if an error occurs
InvalidObjectException:
if the object is not of the expected type
wrongTypeback to summary
private static InvalidObjectException wrongType(final ClassCastException e, final Class<?> expected, final Class<?> actual)