Class FormatIdInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.DataInputStream
-
- org.apache.derby.iapi.services.io.FormatIdInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataInput,java.io.ObjectInput,java.lang.AutoCloseable,CloneableStream,ErrorInfo,ErrorObjectInput,Resetable
public final class FormatIdInputStream extends java.io.DataInputStream implements ErrorObjectInput, Resetable, CloneableStream
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
Fields Modifier and Type Field Description protected ClassFactorycfprivate ErrorInfoerrorInfoprivate java.lang.ExceptionmyNestedException
-
Constructor Summary
Constructors Constructor Description FormatIdInputStream(java.io.InputStream in)Constructor for a FormatIdInputStream
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamcloneStream()Clone the stream.voidcloseStream()Close.(package private) ClassFactorygetClassFactory()private static ContextgetContextOrNull(java.lang.String contextID)Privileged lookup of a Context.java.lang.StringgetErrorInfo()java.io.InputStreamgetInputStream()java.lang.ExceptiongetNestedException()private java.io.ObjectInputStreamgetObjectStream()private <T extends java.lang.Throwable>
ThandleReadError(T cause, java.io.ObjectInputStream stream)Handle an error that happened withinreadObject()when reading aSerializableobject.voidinitStream()Initialize.java.lang.ObjectreadObject()Read an object from this stream.voidresetStream()Reset the stream to the beginning.private voidsetErrorInfo(ErrorInfo ei)voidsetInput(java.io.InputStream in)Set the InputStream for this FormatIdInputStream to the stream provided.-
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
cf
protected ClassFactory cf
-
errorInfo
private ErrorInfo errorInfo
-
myNestedException
private java.lang.Exception myNestedException
-
-
Method Detail
-
readObject
public java.lang.Object readObject() throws java.io.IOException, java.lang.ClassNotFoundExceptionRead an object from this stream.- Specified by:
readObjectin interfacejava.io.ObjectInput- Returns:
- The read object.
- Throws:
java.io.IOException- An IO or serialization error occurred.java.lang.ClassNotFoundException- A class for an object in the stream could not be found.
-
setInput
public void setInput(java.io.InputStream in)
Set the InputStream for this FormatIdInputStream to the stream provided.- Parameters:
in- The new input stream.
-
getInputStream
public java.io.InputStream getInputStream()
-
getErrorInfo
public java.lang.String getErrorInfo()
- Specified by:
getErrorInfoin interfaceErrorInfo- Specified by:
getErrorInfoin interfaceErrorObjectInput
-
getNestedException
public java.lang.Exception getNestedException()
- Specified by:
getNestedExceptionin interfaceErrorInfo- Specified by:
getNestedExceptionin interfaceErrorObjectInput
-
setErrorInfo
private void setErrorInfo(ErrorInfo ei)
-
handleReadError
private <T extends java.lang.Throwable> T handleReadError(T cause, java.io.ObjectInputStream stream)Handle an error that happened withinreadObject()when reading aSerializableobject.- Type Parameters:
T- the type of exception that was thrown- Parameters:
cause- the thrown exceptionstream- the stream from which the exception was thrown- Returns:
- the thrown exception
-
getClassFactory
ClassFactory getClassFactory()
-
getObjectStream
private java.io.ObjectInputStream getObjectStream() throws java.io.IOException- Throws:
java.io.IOException
-
resetStream
public void resetStream() throws java.io.IOException, StandardExceptionDescription copied from interface:ResetableReset the stream to the beginning.- Specified by:
resetStreamin interfaceResetable- Throws:
java.io.IOExceptionStandardException- See Also:
Resetable.resetStream()
-
initStream
public void initStream() throws StandardExceptionDescription copied from interface:ResetableInitialize. Needs to be called first, before a resetable stream can be used.- Specified by:
initStreamin interfaceResetable- Throws:
StandardException- See Also:
Resetable.initStream()
-
closeStream
public void closeStream()
Description copied from interface:ResetableClose. Free resources (such as open containers and locks) associated with the stream.- Specified by:
closeStreamin interfaceResetable- See Also:
Resetable.closeStream()
-
cloneStream
public java.io.InputStream cloneStream()
Description copied from interface:CloneableStreamClone 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.
- Specified by:
cloneStreamin interfaceCloneableStream- Returns:
- The cloned stream.
- See Also:
CloneableStream.cloneStream()
-
getContextOrNull
private static Context getContextOrNull(java.lang.String contextID)
Privileged lookup of a Context. Must be private so that user code can't call this entry point.
-
-