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 TypeMethodDescriptionint
Adds a list/map reference.void
close()
protected String
codeName
(int ch) void
Completes reading the callvoid
Completes reading the callvoid
Completes reading the callprotected IOException
protected IOException
Returns the calls methodStarts reading a string.Returns any reply fault.Gets the serializer factory.void
init
(InputStream is) Initialize the hessian stream with the underlying input stream.boolean
isEnd()
Returns true if this is the end of a list or a map.boolean
Reads a booleanint
readByte()
Reads a byte from the stream.byte[]
Reads a byte arrayint
readBytes
(byte[] buffer, int offset, int length) Reads a byte array from the stream.int
readCall()
Starts reading the callint
readChar()
Reads a byte from the stream.double
Reads a doublevoid
readEnd()
Reads the end byte.float
Reads a floatReads a header, returning null if there are no headers.Reads bytes based on an input stream.int
readInt()
Reads an integerint
Parses the length for an arrayvoid
Reads the end byte.int
Reads the start of a list.long
readLong()
Reads a longvoid
Reads the end byte.int
Reads the start of a list.Starts reading the callreadNode()
Reads an XML node.void
readNull()
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.short
Reads a shortReads a stringint
readString
(char[] buffer, int offset, int length) Reads a byte array from the stream.readType()
Parses a type from the stream.long
Reads a date.void
Resets the references for streaming.resolveRemote
(String type, String url) Resolves a remote object.void
Adds a list/map reference.void
setSerializerFactory
(SerializerFactory factory) Sets the serializer factory.void
For backward compatibility with HessianSkeletonvoid
Starts reading the call, including the headers.void
Starts reading the replyvoid
Starts 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:
setSerializerFactory
in classAbstractHessianInput
-
getSerializerFactory
Gets the serializer factory. -
init
Initialize the hessian stream with the underlying input stream.- Overrides:
init
in classAbstractHessianInput
-
getMethod
Returns the calls method- Specified by:
getMethod
in classAbstractHessianInput
-
getReplyFault
Returns any reply fault. -
readCall
Starts reading the callc major minor
- Specified by:
readCall
in classAbstractHessianInput
- Throws:
IOException
-
skipOptionalCall
For backward compatibility with HessianSkeleton- Overrides:
skipOptionalCall
in classAbstractHessianInput
- Throws:
IOException
-
readMethod
Starts reading the callA successful completion will have a single value:
m b16 b8 method
- Specified by:
readMethod
in 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:
startCall
in classAbstractHessianInput
- Throws:
IOException
-
completeCall
Completes reading the callA successful completion will have a single value:
z
- Specified by:
completeCall
in classAbstractHessianInput
- Throws:
IOException
-
readReply
Reads a reply as an object. If the reply has a fault, throws the exception.- Specified by:
readReply
in classAbstractHessianInput
- Throws:
Throwable
-
startReply
Starts reading the replyA successful completion will have a single value:
r
- Specified by:
startReply
in classAbstractHessianInput
- Throws:
Throwable
-
startReplyBody
Description copied from class:AbstractHessianInput
Starts reading the body of the reply, i.e. after the 'r' has been parsed.- Overrides:
startReplyBody
in classAbstractHessianInput
- Throws:
Throwable
-
completeReply
Completes reading the callA successful completion will have a single value:
z
- Specified by:
completeReply
in 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:
readHeader
in classAbstractHessianInput
- Throws:
IOException
-
readNull
Reads a nullN
- Specified by:
readNull
in classAbstractHessianInput
- Throws:
IOException
-
readBoolean
Reads a booleanT F
- Specified by:
readBoolean
in classAbstractHessianInput
- Throws:
IOException
-
readShort
Reads a shortI b32 b24 b16 b8
- Throws:
IOException
-
readInt
Reads an integerI b32 b24 b16 b8
- Specified by:
readInt
in classAbstractHessianInput
- Throws:
IOException
-
readLong
Reads a longL b64 b56 b48 b40 b32 b24 b16 b8
- Specified by:
readLong
in 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:
readDouble
in classAbstractHessianInput
- Throws:
IOException
-
readUTCDate
Reads a date.T b64 b56 b48 b40 b32 b24 b16 b8
- Specified by:
readUTCDate
in 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:
readString
in classAbstractHessianInput
- Throws:
IOException
-
readNode
Reads an XML node.S b16 b8 string value
- Overrides:
readNode
in classAbstractHessianInput
- Throws:
IOException
-
readBytes
Reads a byte arrayB b16 b8 data value
- Specified by:
readBytes
in 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:
readObject
in 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:
readObject
in classAbstractHessianInput
- Throws:
IOException
-
readRemote
Reads a remote object.- Specified by:
readRemote
in classAbstractHessianInput
- Throws:
IOException
-
readRef
Reads a reference.- Specified by:
readRef
in classAbstractHessianInput
- Throws:
IOException
-
readListStart
Reads the start of a list.- Specified by:
readListStart
in classAbstractHessianInput
- Throws:
IOException
-
readMapStart
Reads the start of a list.- Specified by:
readMapStart
in classAbstractHessianInput
- Throws:
IOException
-
isEnd
Returns true if this is the end of a list or a map.- Specified by:
isEnd
in classAbstractHessianInput
- Throws:
IOException
-
readEnd
Reads the end byte.- Specified by:
readEnd
in classAbstractHessianInput
- Throws:
IOException
-
readMapEnd
Reads the end byte.- Specified by:
readMapEnd
in classAbstractHessianInput
- Throws:
IOException
-
readListEnd
Reads the end byte.- Specified by:
readListEnd
in classAbstractHessianInput
- Throws:
IOException
-
addRef
Adds a list/map reference.- Specified by:
addRef
in classAbstractHessianInput
-
setRef
Adds a list/map reference.- Specified by:
setRef
in classAbstractHessianInput
-
resetReferences
public void resetReferences()Resets the references for streaming.- Overrides:
resetReferences
in classAbstractHessianInput
-
resolveRemote
Resolves a remote object.- Throws:
IOException
-
readType
Parses a type from the stream.t b16 b8
- Specified by:
readType
in classAbstractHessianInput
- Throws:
IOException
-
readLength
Parses the length for an arrayl b32 b24 b16 b8
- Specified by:
readLength
in classAbstractHessianInput
- Throws:
IOException
-
readInputStream
Reads bytes based on an input stream.- Specified by:
readInputStream
in classAbstractHessianInput
- Throws:
IOException
-
close
public void close()- Overrides:
close
in classAbstractHessianInput
-
getReader
Description copied from class:AbstractHessianInput
Starts 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:
getReader
in classAbstractHessianInput
-
expect
-
codeName
-
error
-