com.caucho.hessian.micro

Class MicroHessianInput


public class MicroHessianInput
extends java.lang.Object

Input 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

protected InputStream
is

Constructor Summary

MicroHessianInput()
Creates an uninitialized Hessian input stream.
MicroHessianInput(InputStream is)
Creates a new Hessian input stream, initialized with an underlying input stream.

Method Summary

void
completeReply()
Completes reading the call

A successful completion will have a single value:

 z
 
protected IOException
expect(String expect, int ch)
void
init(InputStream is)
Initialize the hessian stream with the underlying input stream.
protected IOException
protocolException(String message)
boolean
readBoolean()
Reads a boolean
 T
 F
 
byte[]
readBytes()
Reads a byte array
 B b16 b8 data value
 
int
readInt()
Reads an integer
 I b32 b24 b16 b8
 
long
readLong()
Reads a long
 L b64 b56 b48 b40 b32 b24 b16 b8
 
Object
readObject(Class expectedClass)
Reads an arbitrary object the input stream.
String
readString()
Reads a string
 S b16 b8 string value
 
protected String
readStringImpl(int length)
Reads a string from the underlying stream.
long
readUTCDate()
Reads a date.
void
startReply()
Starts reading the reply

A successful completion will have a single value:

 r x01 x00
 

Field Details

is

protected InputStream is

Constructor Details

MicroHessianInput

public MicroHessianInput()
Creates an uninitialized Hessian input stream.

MicroHessianInput

public MicroHessianInput(InputStream is)
Creates a new Hessian input stream, initialized with an underlying input stream.
Parameters:
is - the underlying input stream.

Method Details

completeReply

public void completeReply()
            throws IOException
Completes reading the call

A successful completion will have a single value:

 z
 

expect

protected IOException expect(String expect,
                             int ch)

init

public void init(InputStream is)
Initialize the hessian stream with the underlying input stream.

protocolException

protected IOException protocolException(String message)

readBoolean

public boolean readBoolean()
            throws IOException
Reads a boolean
 T
 F
 

readBytes

public byte[] readBytes()
            throws IOException
Reads a byte array
 B b16 b8 data value
 

readInt

public int readInt()
            throws IOException
Reads an integer
 I b32 b24 b16 b8
 

readLong

public long readLong()
            throws IOException
Reads a long
 L b64 b56 b48 b40 b32 b24 b16 b8
 

readObject

public Object readObject(Class expectedClass)
            throws IOException
Reads an arbitrary object the input stream.

readString

public String readString()
            throws IOException
Reads a string
 S b16 b8 string value
 

readStringImpl

protected String readStringImpl(int length)
            throws IOException
Reads a string from the underlying stream.

readUTCDate

public long readUTCDate()
            throws IOException
Reads a date.
 T b64 b56 b48 b40 b32 b24 b16 b8
 

startReply

public void startReply()
            throws IOException
Starts reading the reply

A successful completion will have a single value:

 r x01 x00