Class BlockUnmarshaller
java.lang.Object
org.jboss.marshalling.river.BlockUnmarshaller
- All Implemented Interfaces:
Closeable, DataInput, ObjectInput, AutoCloseable, ByteInput, Unmarshaller
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.private StreamCorruptedExceptionbadLeadByte(int leadByte) voidDiscard the class cache.voidDiscard the instance cache.voidclose()(package private) voidvoidfinish()Finish unmarshalling from a stream.(package private) booleaninBlock()intread()Reads the next byte of data from the input stream.intread(byte[] b) Read some bytes from the input stream into the given array.intread(byte[] b, int off, int len) Read some bytes from the input stream into the given array.(package private) voidreadBlockHeader(int leadByte) booleanbytereadByte()charreadChar()doublefloatvoidreadFully(byte[] b) voidreadFully(byte[] b, int off, int len) intreadInt()readLine()longreadLong()private ObjectreadObject(boolean unshared) <T> TreadObject(Class<T> type) Read and return an object, cast to a specific type.Read and return an unshared object.<T> TreadObjectUnshared(Class<T> type) Read and return an unshared object, cast to a specific type.short(package private) voidintintreadUTF()(package private) int(package private) voidrestore(int remaining) longskip(long n) Skips over and discards up tonbytes of data from this input stream.intskipBytes(int n) voidBegin unmarshalling from a stream.(package private) int(package private) voidunblock()private static InvalidObjectExceptionwrongType(ClassCastException e, Class<?> expected, Class<?> actual)
-
Field Details
-
riverUnmarshaller
-
remaining
private int remaining
-
-
Constructor Details
-
BlockUnmarshaller
BlockUnmarshaller(RiverUnmarshaller riverUnmarshaller)
-
-
Method Details
-
inBlock
boolean inBlock() -
remaining
int remaining() -
endOfStream
void endOfStream() -
tempEndOfStream
int tempEndOfStream() -
restore
void restore(int remaining) -
unblock
void unblock() -
readBlockHeader
- Throws:
IOException
-
readToEndBlockData
- Throws:
IOExceptionClassNotFoundException
-
badLeadByte
-
readObject
- Specified by:
readObjectin interfaceObjectInput- Throws:
ClassNotFoundExceptionIOException
-
readObject
- Throws:
ClassNotFoundExceptionIOException
-
read
Description copied from interface:ByteInputReads the next byte of data from the input stream. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.- Specified by:
readin interfaceByteInput- Specified by:
readin interfaceObjectInput- Returns:
- the next byte, or -1 if the end of stream has been reached
- Throws:
IOException- if an error occurs
-
read
Description copied from interface:ByteInputRead some bytes from the input stream into the given array. Returns the number of bytes actually read (possibly zero), or -1 if the end of stream has been reached.- Specified by:
readin interfaceByteInput- Specified by:
readin interfaceObjectInput- Parameters:
b- the destination array- Returns:
- the number of bytes read (possibly zero), or -1 if the end of stream has been reached
- Throws:
IOException- if an error occurs
-
read
Description copied from interface:ByteInputRead some bytes from the input stream into the given array. Returns the number of bytes actually read (possibly zero), or -1 if the end of stream has been reached.- Specified by:
readin interfaceByteInput- Specified by:
readin interfaceObjectInput- Parameters:
b- the destination arrayoff- the offset into the array into which data should be readlen- the number of bytes to attempt to fill in the destination array- Returns:
- the number of bytes read (possibly zero), or -1 if the end of stream has been reached
- Throws:
IOException- if an error occurs
-
skip
Description copied from interface:ByteInputSkips over and discards up tonbytes of data from this input stream. If the end of stream is reached, this method returns0in order to be consistent withInputStream.skip(long).- Specified by:
skipin interfaceByteInput- Specified by:
skipin interfaceObjectInput- Parameters:
n- the number of bytes to attempt to skip- Returns:
- the number of bytes skipped
- Throws:
IOException- if an error occurs
-
available
Description copied from interface:ByteInputReturns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.- Specified by:
availablein interfaceByteInput- Specified by:
availablein interfaceObjectInput- Returns:
- the number of bytes
- Throws:
IOException- if an error occurs
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
skipBytes
- Specified by:
skipBytesin interfaceDataInput- Throws:
IOException
-
readBoolean
- Specified by:
readBooleanin interfaceDataInput- Throws:
IOException
-
readByte
- Specified by:
readBytein interfaceDataInput- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedBytein interfaceDataInput- Throws:
IOException
-
readShort
- Specified by:
readShortin interfaceDataInput- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShortin interfaceDataInput- Throws:
IOException
-
readChar
- Specified by:
readCharin interfaceDataInput- Throws:
IOException
-
readInt
- Specified by:
readIntin interfaceDataInput- Throws:
IOException
-
readLong
- Specified by:
readLongin interfaceDataInput- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceDataInput- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceDataInput- Throws:
IOException
-
readLine
- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-
readUTF
- Specified by:
readUTFin interfaceDataInput- Throws:
IOException
-
clearInstanceCache
Description copied from interface:UnmarshallerDiscard the instance cache.- Specified by:
clearInstanceCachein interfaceUnmarshaller- Throws:
IOException- if an error occurs
-
clearClassCache
Description copied from interface:UnmarshallerDiscard the class cache. Implicitly also discards the instance cache.- Specified by:
clearClassCachein interfaceUnmarshaller- Throws:
IOException- if an error occurs
-
start
Description copied from interface:UnmarshallerBegin unmarshalling from a stream.- Specified by:
startin interfaceUnmarshaller- Parameters:
newInput- the new stream- Throws:
IOException- if an error occurs during setup, such as an invalid header
-
finish
Description copied from interface:UnmarshallerFinish unmarshalling from a stream. Any transient class or instance cache is discarded.- Specified by:
finishin interfaceUnmarshaller- Throws:
IOException- if an error occurs
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceObjectInput- Throws:
IOException
-
readObject
Description copied from interface:UnmarshallerRead and return an object, cast to a specific type.- Specified by:
readObjectin interfaceUnmarshaller- 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 foundIOException- if an error occurs
-
wrongType
private static InvalidObjectException wrongType(ClassCastException e, Class<?> expected, Class<?> actual)
-