Package com.caucho.hessian.io
Class AbstractHessianInput
- java.lang.Object
-
- com.caucho.hessian.io.AbstractHessianInput
-
- Direct Known Subclasses:
AbstractBurlapInput,Hessian2Input,HessianInput
public abstract class AbstractHessianInput extends Object
Abstract base class for Hessian requests. Hessian users should only need to use the methods in this class.AbstractHessianInput in = ...; // get input String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer
-
-
Constructor Summary
Constructors Constructor Description AbstractHessianInput()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intaddRef(Object obj)Adds an object reference.voidclose()abstract voidcompleteCall()Completes reading the callabstract voidcompleteReply()Completes reading the callabstract StringgetMethod()Returns the call's methodabstract ReadergetReader()Starts reading a string.HessianRemoteResolvergetRemoteResolver()Sets the resolver used to lookup remote objects.voidinit(InputStream is)Initialize the Hessian stream with the underlying input stream.abstract booleanisEnd()Returns true if the data has ended.abstract booleanreadBoolean()Reads a booleanabstract byte[]readBytes()Reads a byte array.abstract intreadCall()Reads the callabstract doublereadDouble()Reads a double.abstract voidreadEnd()Read the end byteabstract StringreadHeader()Reads a header, returning null if there are no headers.abstract InputStreamreadInputStream()Starts reading a byte array using an input stream.abstract intreadInt()Reads an integerabstract intreadLength()Reads the length of a list.abstract voidreadListEnd()Read the end byteabstract intreadListStart()Reads the start of a listabstract longreadLong()Reads a longabstract voidreadMapEnd()Read the end byteabstract intreadMapStart()Reads the start of a mapabstract StringreadMethod()Starts reading the callintreadMethodArgLength()Reads the number of method argumentsNodereadNode()Reads an XML node encoded in UTF-8abstract voidreadNull()Reads a nullabstract ObjectreadObject()Reads an arbitrary object from the input stream.abstract ObjectreadObject(Class expectedClass)Reads an arbitrary object from the input stream.abstract ObjectreadRef()Reads a referenceabstract ObjectreadRemote()Reads a remote object reference to the stream.abstract ObjectreadReply(Class expectedClass)Reads a reply as an object.abstract StringreadString()Reads a string encoded in UTF-8booleanreadToOutputStream(OutputStream os)Reads data to an output stream.abstract StringreadType()Reads an object type.abstract longreadUTCDate()Reads a date.voidresetReferences()Resets the references for streaming.abstract voidsetRef(int i, Object obj)Sets an object reference.voidsetRemoteResolver(HessianRemoteResolver resolver)Sets the resolver used to lookup remote objects.voidsetSerializerFactory(SerializerFactory ser)Sets the serializer factory.voidskipOptionalCall()For backward compatibility with HessianSkeletonabstract voidstartCall()Starts reading the call, including the headers.abstract voidstartReply()Starts reading the replyvoidstartReplyBody()Starts reading the body of the reply, i.e.
-
-
-
Method Detail
-
init
public void init(InputStream is)
Initialize the Hessian stream with the underlying input stream.
-
getMethod
public abstract String getMethod()
Returns the call's method
-
setRemoteResolver
public void setRemoteResolver(HessianRemoteResolver resolver)
Sets the resolver used to lookup remote objects.
-
getRemoteResolver
public HessianRemoteResolver getRemoteResolver()
Sets the resolver used to lookup remote objects.
-
setSerializerFactory
public void setSerializerFactory(SerializerFactory ser)
Sets the serializer factory.
-
readCall
public abstract int readCall() throws IOExceptionReads the callc major minor
- Throws:
IOException
-
skipOptionalCall
public void skipOptionalCall() throws IOExceptionFor backward compatibility with HessianSkeleton- Throws:
IOException
-
readHeader
public abstract String readHeader() throws IOException
Reads a header, returning null if there are no headers.H b16 b8 value
- Throws:
IOException
-
readMethod
public abstract String readMethod() throws IOException
Starts reading the callA successful completion will have a single value:
m b16 b8 method
- Throws:
IOException
-
readMethodArgLength
public int readMethodArgLength() throws IOExceptionReads the number of method arguments- Returns:
- -1 for a variable length (hessian 1.0)
- Throws:
IOException
-
startCall
public abstract void startCall() throws IOExceptionStarts reading the call, including the headers.The call expects the following protocol data
c major minor m b16 b8 method
- Throws:
IOException
-
completeCall
public abstract void completeCall() throws IOExceptionCompletes reading the callThe call expects the following protocol data
Z
- Throws:
IOException
-
readReply
public abstract Object readReply(Class expectedClass) throws Throwable
Reads a reply as an object. If the reply has a fault, throws the exception.- Throws:
Throwable
-
startReply
public abstract void startReply() throws ThrowableStarts reading the replyA successful completion will have a single value:
r v
- Throws:
Throwable
-
startReplyBody
public void startReplyBody() throws ThrowableStarts reading the body of the reply, i.e. after the 'r' has been parsed.- Throws:
Throwable
-
completeReply
public abstract void completeReply() throws IOExceptionCompletes reading the callA successful completion will have a single value:
z
- Throws:
IOException
-
readBoolean
public abstract boolean readBoolean() throws IOExceptionReads a booleanT F
- Throws:
IOException
-
readNull
public abstract void readNull() throws IOExceptionReads a nullN
- Throws:
IOException
-
readInt
public abstract int readInt() throws IOExceptionReads an integerI b32 b24 b16 b8
- Throws:
IOException
-
readLong
public abstract long readLong() throws IOExceptionReads a longL b64 b56 b48 b40 b32 b24 b16 b8
- Throws:
IOException
-
readDouble
public abstract double readDouble() throws IOExceptionReads a double.D b64 b56 b48 b40 b32 b24 b16 b8
- Throws:
IOException
-
readUTCDate
public abstract long readUTCDate() throws IOExceptionReads a date.T b64 b56 b48 b40 b32 b24 b16 b8
- Throws:
IOException
-
readString
public abstract String readString() throws IOException
Reads a string encoded in UTF-8s b16 b8 non-final string chunk S b16 b8 final string chunk
- Throws:
IOException
-
readNode
public Node readNode() throws IOException
Reads an XML node encoded in UTF-8x b16 b8 non-final xml chunk X b16 b8 final xml chunk
- Throws:
IOException
-
getReader
public abstract Reader getReader() throws IOException
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
- Throws:
IOException
-
readInputStream
public abstract InputStream readInputStream() throws IOException
Starts reading a byte array using an input stream. All the bytes must be read before calling the following method.b b16 b8 non-final binary chunk B b16 b8 final binary chunk
- Throws:
IOException
-
readToOutputStream
public boolean readToOutputStream(OutputStream os) throws IOException
Reads data to an output stream.b b16 b8 non-final binary chunk B b16 b8 final binary chunk
- Throws:
IOException
-
readBytes
public abstract byte[] readBytes() throws IOExceptionReads a byte array.b b16 b8 non-final binary chunk B b16 b8 final binary chunk
- Throws:
IOException
-
readObject
public abstract Object readObject(Class expectedClass) throws IOException
Reads an arbitrary object from the input stream.- Parameters:
expectedClass- the expected class if the protocol doesn't supply it.- Throws:
IOException
-
readObject
public abstract Object readObject() throws IOException
Reads an arbitrary object from the input stream.- Throws:
IOException
-
readRemote
public abstract Object readRemote() throws IOException
Reads a remote object reference to the stream. The type is the type of the remote interface.'r' 't' b16 b8 type url
- Throws:
IOException
-
readRef
public abstract Object readRef() throws IOException
Reads a referenceR b32 b24 b16 b8
- Throws:
IOException
-
addRef
public abstract int addRef(Object obj) throws IOException
Adds an object reference.- Throws:
IOException
-
setRef
public abstract void setRef(int i, Object obj) throws IOExceptionSets an object reference.- Throws:
IOException
-
resetReferences
public void resetReferences()
Resets the references for streaming.
-
readListStart
public abstract int readListStart() throws IOExceptionReads the start of a list- Throws:
IOException
-
readLength
public abstract int readLength() throws IOExceptionReads the length of a list.- Throws:
IOException
-
readMapStart
public abstract int readMapStart() throws IOExceptionReads the start of a map- Throws:
IOException
-
readType
public abstract String readType() throws IOException
Reads an object type.- Throws:
IOException
-
isEnd
public abstract boolean isEnd() throws IOExceptionReturns true if the data has ended.- Throws:
IOException
-
readEnd
public abstract void readEnd() throws IOExceptionRead the end byte- Throws:
IOException
-
readMapEnd
public abstract void readMapEnd() throws IOExceptionRead the end byte- Throws:
IOException
-
readListEnd
public abstract void readListEnd() throws IOExceptionRead the end byte- Throws:
IOException
-
close
public void close() throws IOException- Throws:
IOException
-
-