Package com.caucho.hessian.io
Class HessianInput
java.lang.Object
com.caucho.hessian.io.AbstractHessianInput
com.caucho.hessian.io.HessianInput
Input stream for Hessian requests.
HessianInput is unbuffered, so any client needs to provide its own buffering.
InputStream is = ...; // from http connection HessianInput in = new HessianInput(is); String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an uninitialized Hessian input stream.Creates a new Hessian input stream, initialized with an underlying input stream. -
Method Summary
Modifier and TypeMethodDescriptionintAdds a list/map reference.voidclose()protected StringcodeName(int ch) voidCompletes reading the callvoidCompletes reading the callvoidCompletes reading the callprotected IOExceptionprotected IOExceptionReturns the calls methodStarts reading a string.Returns any reply fault.Gets the serializer factory.voidinit(InputStream is) Initialize the hessian stream with the underlying input stream.booleanisEnd()Returns true if this is the end of a list or a map.booleanReads a booleanintreadByte()Reads a byte from the stream.byte[]Reads a byte arrayintreadBytes(byte[] buffer, int offset, int length) Reads a byte array from the stream.intreadCall()Starts reading the callintreadChar()Reads a byte from the stream.doubleReads a doublevoidreadEnd()Reads the end byte.floatReads a floatReads a header, returning null if there are no headers.Reads bytes based on an input stream.intreadInt()Reads an integerintParses the length for an arrayvoidReads the end byte.intReads the start of a list.longreadLong()Reads a longvoidReads the end byte.intReads the start of a list.Starts reading the callreadNode()Reads an XML node.voidreadNull()Reads a nullReads an arbitrary object from the input stream when the type is unknown.readObject(Class cl) Reads an object from the input stream with an expected type.readRef()Reads a reference.Reads a remote object.Reads a reply as an object.shortReads a shortReads a stringintreadString(char[] buffer, int offset, int length) Reads a byte array from the stream.readType()Parses a type from the stream.longReads a date.voidResets the references for streaming.resolveRemote(String type, String url) Resolves a remote object.voidAdds a list/map reference.voidsetSerializerFactory(SerializerFactory factory) Sets the serializer factory.voidFor backward compatibility with HessianSkeletonvoidStarts reading the call, including the headers.voidStarts reading the replyvoidStarts reading the body of the reply, i.e.Methods inherited from class com.caucho.hessian.io.AbstractHessianInput
getRemoteResolver, readMethodArgLength, readToOutputStream, setRemoteResolver
-
Field Details
-
_serializerFactory
-
_refs
-
_peek
protected int _peek
-
-
Constructor Details
-
HessianInput
public HessianInput()Creates an uninitialized Hessian input stream. -
HessianInput
Creates a new Hessian input stream, initialized with an underlying input stream.- Parameters:
is- the underlying input stream.
-
-
Method Details
-
setSerializerFactory
Sets the serializer factory.- Overrides:
setSerializerFactoryin classAbstractHessianInput
-
getSerializerFactory
Gets the serializer factory. -
init
Initialize the hessian stream with the underlying input stream.- Overrides:
initin classAbstractHessianInput
-
getMethod
Returns the calls method- Specified by:
getMethodin classAbstractHessianInput
-
getReplyFault
Returns any reply fault. -
readCall
Starts reading the callc major minor
- Specified by:
readCallin classAbstractHessianInput- Throws:
IOException
-
skipOptionalCall
For backward compatibility with HessianSkeleton- Overrides:
skipOptionalCallin classAbstractHessianInput- Throws:
IOException
-
readMethod
Starts reading the callA successful completion will have a single value:
m b16 b8 method
- Specified by:
readMethodin classAbstractHessianInput- Throws:
IOException
-
startCall
Starts reading the call, including the headers.The call expects the following protocol data
c major minor m b16 b8 method
- Specified by:
startCallin classAbstractHessianInput- Throws:
IOException
-
completeCall
Completes reading the callA successful completion will have a single value:
z
- Specified by:
completeCallin classAbstractHessianInput- Throws:
IOException
-
readReply
Reads a reply as an object. If the reply has a fault, throws the exception.- Specified by:
readReplyin classAbstractHessianInput- Throws:
Throwable
-
startReply
Starts reading the replyA successful completion will have a single value:
r
- Specified by:
startReplyin classAbstractHessianInput- Throws:
Throwable
-
startReplyBody
Description copied from class:AbstractHessianInputStarts reading the body of the reply, i.e. after the 'r' has been parsed.- Overrides:
startReplyBodyin classAbstractHessianInput- Throws:
Throwable
-
completeReply
Completes reading the callA successful completion will have a single value:
z
- Specified by:
completeReplyin classAbstractHessianInput- Throws:
IOException
-
completeValueReply
Completes reading the callA successful completion will have a single value:
z
- Throws:
IOException
-
readHeader
Reads a header, returning null if there are no headers.H b16 b8 value
- Specified by:
readHeaderin classAbstractHessianInput- Throws:
IOException
-
readNull
Reads a nullN
- Specified by:
readNullin classAbstractHessianInput- Throws:
IOException
-
readBoolean
Reads a booleanT F
- Specified by:
readBooleanin classAbstractHessianInput- Throws:
IOException
-
readShort
Reads a shortI b32 b24 b16 b8
- Throws:
IOException
-
readInt
Reads an integerI b32 b24 b16 b8
- Specified by:
readIntin classAbstractHessianInput- Throws:
IOException
-
readLong
Reads a longL b64 b56 b48 b40 b32 b24 b16 b8
- Specified by:
readLongin classAbstractHessianInput- Throws:
IOException
-
readFloat
Reads a floatD b64 b56 b48 b40 b32 b24 b16 b8
- Throws:
IOException
-
readDouble
Reads a doubleD b64 b56 b48 b40 b32 b24 b16 b8
- Specified by:
readDoublein classAbstractHessianInput- Throws:
IOException
-
readUTCDate
Reads a date.T b64 b56 b48 b40 b32 b24 b16 b8
- Specified by:
readUTCDatein classAbstractHessianInput- Throws:
IOException
-
readChar
Reads a byte from the stream.- Throws:
IOException
-
readString
Reads a byte array from the stream.- Throws:
IOException
-
readString
Reads a stringS b16 b8 string value
- Specified by:
readStringin classAbstractHessianInput- Throws:
IOException
-
readNode
Reads an XML node.S b16 b8 string value
- Overrides:
readNodein classAbstractHessianInput- Throws:
IOException
-
readBytes
Reads a byte arrayB b16 b8 data value
- Specified by:
readBytesin classAbstractHessianInput- Throws:
IOException
-
readByte
Reads a byte from the stream.- Throws:
IOException
-
readBytes
Reads a byte array from the stream.- Throws:
IOException
-
readObject
Reads an object from the input stream with an expected type.- Specified by:
readObjectin classAbstractHessianInput- Parameters:
cl- the expected class if the protocol doesn't supply it.- Throws:
IOException
-
readObject
Reads an arbitrary object from the input stream when the type is unknown.- Specified by:
readObjectin classAbstractHessianInput- Throws:
IOException
-
readRemote
Reads a remote object.- Specified by:
readRemotein classAbstractHessianInput- Throws:
IOException
-
readRef
Reads a reference.- Specified by:
readRefin classAbstractHessianInput- Throws:
IOException
-
readListStart
Reads the start of a list.- Specified by:
readListStartin classAbstractHessianInput- Throws:
IOException
-
readMapStart
Reads the start of a list.- Specified by:
readMapStartin classAbstractHessianInput- Throws:
IOException
-
isEnd
Returns true if this is the end of a list or a map.- Specified by:
isEndin classAbstractHessianInput- Throws:
IOException
-
readEnd
Reads the end byte.- Specified by:
readEndin classAbstractHessianInput- Throws:
IOException
-
readMapEnd
Reads the end byte.- Specified by:
readMapEndin classAbstractHessianInput- Throws:
IOException
-
readListEnd
Reads the end byte.- Specified by:
readListEndin classAbstractHessianInput- Throws:
IOException
-
addRef
Adds a list/map reference.- Specified by:
addRefin classAbstractHessianInput
-
setRef
Adds a list/map reference.- Specified by:
setRefin classAbstractHessianInput
-
resetReferences
public void resetReferences()Resets the references for streaming.- Overrides:
resetReferencesin classAbstractHessianInput
-
resolveRemote
Resolves a remote object.- Throws:
IOException
-
readType
Parses a type from the stream.t b16 b8
- Specified by:
readTypein classAbstractHessianInput- Throws:
IOException
-
readLength
Parses the length for an arrayl b32 b24 b16 b8
- Specified by:
readLengthin classAbstractHessianInput- Throws:
IOException
-
readInputStream
Reads bytes based on an input stream.- Specified by:
readInputStreamin classAbstractHessianInput- Throws:
IOException
-
close
public void close()- Overrides:
closein classAbstractHessianInput
-
getReader
Description copied from class:AbstractHessianInputStarts reading a string. All the characters must be read before calling the next method. The actual characters will be read with the reader's read() or read(char [], int, int).s b16 b8 non-final string chunk S b16 b8 final string chunk
- Specified by:
getReaderin classAbstractHessianInput
-
expect
-
codeName
-
error
-