Package com.caucho.hessian.micro
Class MicroHessianInput
- java.lang.Object
-
- com.caucho.hessian.micro.MicroHessianInput
-
public class MicroHessianInput extends java.lang.ObjectInput stream for Hessian requests, compatible with microedition Java. It only uses classes and types available to J2ME. In particular, it does not have any support for the <double> type.MicroHessianInput does not depend on any classes other than in J2ME, so it can be extracted independently into a smaller package.
MicroHessianInput is unbuffered, so any client needs to provide its own buffering.
InputStream is = ...; // from http connection MicroHessianInput in = new MicroHessianInput(is); String value; in.startReply(); // read reply header value = in.readString(); // read string value in.completeReply(); // read reply footer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.InputStreamis
-
Constructor Summary
Constructors Constructor Description MicroHessianInput()Creates an uninitialized Hessian input stream.MicroHessianInput(java.io.InputStream is)Creates a new Hessian input stream, initialized with an underlying input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompleteReply()Completes reading the callprotected java.io.IOExceptionexpect(java.lang.String expect, int ch)voidinit(java.io.InputStream is)Initialize the hessian stream with the underlying input stream.protected java.io.IOExceptionprotocolException(java.lang.String message)booleanreadBoolean()Reads a booleanbyte[]readBytes()Reads a byte arrayintreadInt()Reads an integerlongreadLong()Reads a longjava.lang.ObjectreadObject(java.lang.Class expectedClass)Reads an arbitrary object the input stream.java.lang.StringreadString()Reads a stringprotected java.lang.StringreadStringImpl(int length)Reads a string from the underlying stream.longreadUTCDate()Reads a date.voidstartReply()Starts reading the reply
-
-
-
Constructor Detail
-
MicroHessianInput
public MicroHessianInput(java.io.InputStream is)
Creates a new Hessian input stream, initialized with an underlying input stream.- Parameters:
is- the underlying input stream.
-
MicroHessianInput
public MicroHessianInput()
Creates an uninitialized Hessian input stream.
-
-
Method Detail
-
init
public void init(java.io.InputStream is)
Initialize the hessian stream with the underlying input stream.
-
startReply
public void startReply() throws java.io.IOExceptionStarts reading the replyA successful completion will have a single value:
r x01 x00
- Throws:
java.io.IOException
-
completeReply
public void completeReply() throws java.io.IOExceptionCompletes reading the callA successful completion will have a single value:
z
- Throws:
java.io.IOException
-
readBoolean
public boolean readBoolean() throws java.io.IOExceptionReads a booleanT F
- Throws:
java.io.IOException
-
readInt
public int readInt() throws java.io.IOExceptionReads an integerI b32 b24 b16 b8
- Throws:
java.io.IOException
-
readLong
public long readLong() throws java.io.IOExceptionReads a longL b64 b56 b48 b40 b32 b24 b16 b8
- Throws:
java.io.IOException
-
readUTCDate
public long readUTCDate() throws java.io.IOExceptionReads a date.T b64 b56 b48 b40 b32 b24 b16 b8
- Throws:
java.io.IOException
-
readString
public java.lang.String readString() throws java.io.IOExceptionReads a stringS b16 b8 string value
- Throws:
java.io.IOException
-
readBytes
public byte[] readBytes() throws java.io.IOExceptionReads a byte arrayB b16 b8 data value
- Throws:
java.io.IOException
-
readObject
public java.lang.Object readObject(java.lang.Class expectedClass) throws java.io.IOExceptionReads an arbitrary object the input stream.- Throws:
java.io.IOException
-
readStringImpl
protected java.lang.String readStringImpl(int length) throws java.io.IOExceptionReads a string from the underlying stream.- Throws:
java.io.IOException
-
expect
protected java.io.IOException expect(java.lang.String expect, int ch)
-
protocolException
protected java.io.IOException protocolException(java.lang.String message)
-
-