Top Description Fields Constructors Methods
org.apache.derby.iapi.services.io

public final Class FormatIdInputStream

extends DataInputStream
implements ErrorObjectInput, Resetable, CloneableStream
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.CloneableStream, org.apache.derby.iapi.types.Resetable, org.apache.derby.iapi.services.io.ErrorObjectInput, org.apache.derby.iapi.services.io.ErrorInfo, java.io.ObjectInput, java.lang.AutoCloseable, java.io.DataInput
Imports
java.io.DataInputStream, .IOException, .InputStream, .ObjectInputStream, .StreamCorruptedException, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.loader.ClassFactory, .ClassFactoryContext, org.apache.derby.iapi.types.Resetable, org.apache.derby.iapi.services.context.Context, .ContextService

A stream for reading objects with format id tags which was produced by a FormatIdOutputStream.

Please see the documentation for FormatIdOutputStream for information about the streams format and capabilites.

Field Summary

Modifier and TypeField and Description
protected ClassFactory
private ErrorInfo
private Exception

Constructor Summary

AccessConstructor and Description
public
FormatIdInputStream(InputStream
bytes come from here.
in
)

Constructor for a FormatIdInputStream

Method Summary

Modifier and TypeMethod and Description
public InputStream
public void
pack-priv ClassFactory
private static Context
getContextOrNull(final String contextID)

Must be private so that user code can't call this entry point.

public String
public InputStream
public Exception
private ObjectInputStream
private <
the type of exception that was thrown
T extends Throwable
>
T

Returns:

the thrown exception
handleReadError
(T
the thrown exception
cause
,
ObjectInputStream
the stream from which the exception was thrown
stream
)

Handle an error that happened within readObject() when reading a Serializable object.

public void
public Object

Returns:

The read object.
readObject
()

Implements java.io.ObjectInput.readObject.

Read an object from this stream.

public void
resetStream()

Implements org.apache.derby.iapi.types.Resetable.resetStream.

Reset the stream to the beginning.

private void
public void
setInput(InputStream
The new input stream.
in
)

Set the InputStream for this FormatIdInputStream to the stream provided.

Inherited from java.io.DataInputStream:
readreadreadBooleanreadBytereadCharreadDoublereadFloatreadFullyreadFullyreadIntreadLinereadLongreadShortreadUnsignedBytereadUnsignedShortreadUTFreadUTFskipBytes

Field Detail

cfback to summary
protected ClassFactory cf
errorInfoback to summary
private ErrorInfo errorInfo
myNestedExceptionback to summary
private Exception myNestedException

Constructor Detail

FormatIdInputStreamback to summary
public FormatIdInputStream(InputStream in)

Constructor for a FormatIdInputStream

Parameters
in:InputStream

bytes come from here.

Method Detail

cloneStreamback to summary
public InputStream cloneStream()

Implements org.apache.derby.iapi.services.io.CloneableStream.cloneStream.

Doc from org.apache.derby.iapi.services.io.CloneableStream.cloneStream.

Clone the stream.

To be used when a "deep" clone of a stream is required rather than multiple references to the same stream.

The resulting clone should support reads, resets, closes which do not affect the original stream source of the clone.

Returns:InputStream

The cloned stream.

See Also
CloneableStream#cloneStream()
closeStreamback to summary
public void closeStream()

Implements org.apache.derby.iapi.types.Resetable.closeStream.

Doc from org.apache.derby.iapi.types.Resetable.closeStream.

Close. Free resources (such as open containers and locks) associated with the stream.

See Also
Resetable#closeStream()
getClassFactoryback to summary
pack-priv ClassFactory getClassFactory()
getContextOrNullback to summary
private static Context getContextOrNull(final String contextID)

Must be private so that user code can't call this entry point.

getErrorInfoback to summary
public String getErrorInfo()

Implements org.apache.derby.iapi.services.io.ErrorObjectInput.getErrorInfo.

getInputStreamback to summary
public InputStream getInputStream()
getNestedExceptionback to summary
public Exception getNestedException()

Implements org.apache.derby.iapi.services.io.ErrorObjectInput.getNestedException.

getObjectStreamback to summary
private ObjectInputStream getObjectStream() throws IOException
handleReadErrorback to summary
private <T extends Throwable> T handleReadError(T cause, ObjectInputStream stream)

Handle an error that happened within readObject() when reading a Serializable object.

Parameters
<T>
the type of exception that was thrown
cause:T

the thrown exception

stream:ObjectInputStream

the stream from which the exception was thrown

Returns:T

the thrown exception

initStreamback to summary
public void initStream() throws StandardException

Implements org.apache.derby.iapi.types.Resetable.initStream.

Doc from org.apache.derby.iapi.types.Resetable.initStream.

Initialize. Needs to be called first, before a resetable stream can be used.

Exceptions
StandardException:
on error
See Also
Resetable#initStream()
readObjectback to summary
public Object readObject() throws IOException, ClassNotFoundException

Implements java.io.ObjectInput.readObject.

Read an object from this stream.

Returns:Object

The read object.

Exceptions
IOException:
An IO or serialization error occurred.
ClassNotFoundException:
A class for an object in the stream could not be found.
resetStreamback to summary
public void resetStream() throws IOException, StandardException

Implements org.apache.derby.iapi.types.Resetable.resetStream.

Doc from org.apache.derby.iapi.types.Resetable.resetStream.

Reset the stream to the beginning.

Exceptions
IOException:
on error
StandardException:
on error
See Also
Resetable#resetStream()
setErrorInfoback to summary
private void setErrorInfo(ErrorInfo ei)
setInputback to summary
public void setInput(InputStream in)

Set the InputStream for this FormatIdInputStream to the stream provided.

Parameters
in:InputStream

The new input stream.