|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.caucho.hessian.micro.MicroHessianOutput
public class MicroHessianOutput
Output 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.
MicroHessianOutput does not depend on any classes other than in J2ME, so it can be extracted independently into a smaller package.
MicroHessianOutput is unbuffered, so any client needs to provide its own buffering.
OutputStream os = ...; // from http connection MicroHessianOutput out = new MicroHessianOutput(os); String value; out.startCall("hello"); // start hello call out.writeString("arg1"); // write a string argument out.completeCall(); // complete the call
Field Summary | |
---|---|
protected java.io.OutputStream |
os
|
Constructor Summary | |
---|---|
MicroHessianOutput()
Creates an uninitialized Hessian output stream. |
|
MicroHessianOutput(java.io.OutputStream os)
Creates a new Hessian output stream, initialized with an underlying output stream. |
Method Summary | |
---|---|
void |
completeCall()
Writes the method call:
z
|
void |
init(java.io.OutputStream os)
|
void |
printLenString(java.lang.String v)
Prints a string to the stream, encoded as UTF-8 with preceeding length |
void |
printString(java.lang.String v)
Prints a string to the stream, encoded as UTF-8 |
void |
printString(java.lang.String v,
int offset,
int length)
Prints a string to the stream, encoded as UTF-8 |
void |
startCall(java.lang.String method)
Writes the method call:
c major minor
m b16 b8 method-namek
|
void |
writeBoolean(boolean value)
Writes a boolean value to the stream. |
void |
writeBytes(byte[] buffer)
Writes a byte array to the stream. |
void |
writeBytes(byte[] buffer,
int offset,
int length)
Writes a byte array to the stream. |
void |
writeCustomObject(java.lang.Object object)
Applications which override this can do custom serialization. |
void |
writeInt(int value)
Writes an integer value to the stream. |
void |
writeListBegin(int length,
java.lang.String type)
Writes the list header to the stream. |
void |
writeListEnd()
Writes the tail of the list to the stream. |
void |
writeLong(long value)
Writes a long value to the stream. |
void |
writeMapBegin(java.lang.String type)
Writes the map header to the stream. |
void |
writeMapEnd()
Writes the tail of the map to the stream. |
void |
writeNull()
Writes a null value to the stream. |
void |
writeObject(java.lang.Object object)
Writes a generic object to the output stream. |
void |
writeRef(int value)
Writes a reference. |
void |
writeRemote(java.lang.String type,
java.lang.String url)
Writes a remote object reference to the stream. |
void |
writeString(java.lang.String value)
Writes a string value to the stream using UTF-8 encoding. |
void |
writeUTCDate(long time)
Writes a date to the stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.OutputStream os
Constructor Detail |
---|
public MicroHessianOutput(java.io.OutputStream os)
os
- the underlying output stream.public MicroHessianOutput()
Method Detail |
---|
public void init(java.io.OutputStream os)
public void startCall(java.lang.String method) throws java.io.IOException
c major minor
m b16 b8 method-namek
method
- the method name to call.
java.io.IOException
public void completeCall() throws java.io.IOException
z
java.io.IOException
public void writeBoolean(boolean value) throws java.io.IOException
T
F
value
- the boolean value to write.
java.io.IOException
public void writeInt(int value) throws java.io.IOException
I b32 b24 b16 b8
value
- the integer value to write.
java.io.IOException
public void writeLong(long value) throws java.io.IOException
L b64 b56 b48 b40 b32 b24 b16 b8
value
- the long value to write.
java.io.IOException
public void writeUTCDate(long time) throws java.io.IOException
T b64 b56 b48 b40 b32 b24 b16 b8
time
- the date in milliseconds from the epoch in UTC
java.io.IOException
public void writeNull() throws java.io.IOException
N
value
- the string value to write.
java.io.IOException
public void writeString(java.lang.String value) throws java.io.IOException
S b16 b8 string-value
If the value is null, it will be written as
N
value
- the string value to write.
java.io.IOException
public void writeBytes(byte[] buffer) throws java.io.IOException
B b16 b18 bytes
If the value is null, it will be written as
N
value
- the string value to write.
java.io.IOException
public void writeBytes(byte[] buffer, int offset, int length) throws java.io.IOException
B b16 b18 bytes
If the value is null, it will be written as
N
value
- the string value to write.
java.io.IOException
public void writeRef(int value) throws java.io.IOException
R b32 b24 b16 b8
value
- the integer value to write.
java.io.IOException
public void writeObject(java.lang.Object object) throws java.io.IOException
java.io.IOException
public void writeCustomObject(java.lang.Object object) throws java.io.IOException
object
- the object to write.
java.io.IOException
public void writeListBegin(int length, java.lang.String type) throws java.io.IOException
writeListBegin
followed by the list contents and then call
writeListEnd
.
<list>
<type>java.util.ArrayList</type>
<length>3</length>
<int>1</int>
<int>2</int>
<int>3</int>
</list>
java.io.IOException
public void writeListEnd() throws java.io.IOException
java.io.IOException
public void writeMapBegin(java.lang.String type) throws java.io.IOException
writeMapBegin
followed by the map contents and then call
writeMapEnd
.
Mt b16 b8 type ( )z
java.io.IOException
public void writeMapEnd() throws java.io.IOException
java.io.IOException
public void writeRemote(java.lang.String type, java.lang.String url) throws java.io.IOException
'r' 't' b16 b8 type url
java.io.IOException
public void printLenString(java.lang.String v) throws java.io.IOException
v
- the string to print.
java.io.IOException
public void printString(java.lang.String v) throws java.io.IOException
v
- the string to print.
java.io.IOException
public void printString(java.lang.String v, int offset, int length) throws java.io.IOException
v
- the string to print.
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc