| java.lang.Object com.caucho.hessian.io.AbstractHessianOutput com.caucho.hessian.io.HessianOutput
All known Subclasses: com.caucho.hessian.io.HessianSerializerOutput,
HessianOutput | public class HessianOutput extends AbstractHessianOutput (Code) | | Output stream for Hessian requests, compatible with microedition
Java. It only uses classes and types available in JDK.
Since HessianOutput does not depend on any classes other than
in the JDK, it can be extracted independently into a smaller package.
HessianOutput is unbuffered, so any client needs to provide
its own buffering.
OutputStream os = ...; // from http connection
HessianOutput out = new HessianOutput(os);
String value;
out.startCall("hello"); // start hello call
out.writeString("arg1"); // write a string argument
out.completeCall(); // complete the call
|
Constructor Summary | |
public | HessianOutput(OutputStream os) Creates a new Hessian output stream, initialized with an
underlying output stream. | public | HessianOutput() Creates an uninitialized Hessian output stream. |
Method Summary | |
public boolean | addRef(Object object) If the object has already been written, just write its ref. | public void | call(String method, Object[] args) Writes a complete method call. | public void | completeCall() Completes. | public void | completeReply() | public void | init(OutputStream os) | public void | printLenString(String v) | public void | printString(String v) | public void | printString(String v, int offset, int length) | public void | printString(char[] v, int offset, int length) | public boolean | removeRef(Object obj) Removes a reference. | public boolean | replaceRef(Object oldRef, Object newRef) Replaces a reference from one object to another. | public void | resetReferences() Resets the references for streaming. | public void | setVersion(int version) Sets the client's version. | public void | startCall(String method) Starts the method call. | public void | startCall() Writes the call tag. | public void | startReply() | public void | writeBoolean(boolean value) Writes a boolean value to the stream. | public void | writeByteBufferEnd(byte[] buffer, int offset, int length) Writes a byte buffer to the stream. | public void | writeByteBufferPart(byte[] buffer, int offset, int length) Writes a byte buffer to the stream. | public void | writeByteBufferStart() Writes a byte buffer to the stream. | public void | writeBytes(byte[] buffer) Writes a byte array to the stream. | public void | writeBytes(byte[] buffer, int offset, int length) Writes a byte array to the stream. | public void | writeDouble(double value) Writes a double value to the stream. | public void | writeFault(String code, String message, Object detail) Writes a fault. | public void | writeHeader(String name) Writes a header name. | public void | writeInt(int value) Writes an integer value to the stream. | public boolean | writeListBegin(int length, String type) Writes the list header to the stream. | public void | writeListEnd() Writes the tail of the list to the stream. | public void | writeLong(long value) Writes a long value to the stream. | public void | writeMapBegin(String type) Writes the map header to the stream. | public void | writeMapEnd() Writes the tail of the map to the stream. | public void | writeMethod(String method) Writes the method tag. | public void | writeNull() Writes a null value to the stream. | public void | writeObject(Object object) Writes any object to the output stream. | public void | writePlaceholder() Writes a placeholder. | public void | writeRef(int value) Writes a reference. | public void | writeRemote(String type, String url) Writes a remote object reference to the stream. | public void | writeString(String value) Writes a string value to the stream using UTF-8 encoding. | public void | writeString(char[] buffer, int offset, int length) Writes a string value to the stream using UTF-8 encoding. | public void | writeUTCDate(long time) Writes a date to the stream. |
HessianOutput | public HessianOutput(OutputStream os)(Code) | | Creates a new Hessian output stream, initialized with an
underlying output stream.
Parameters: os - the underlying output stream. |
HessianOutput | public HessianOutput()(Code) | | Creates an uninitialized Hessian output stream.
|
addRef | public boolean addRef(Object object) throws IOException(Code) | | If the object has already been written, just write its ref.
true if we're writing a ref. |
completeReply | public void completeReply() throws IOException(Code) | | Completes reading the reply
A successful completion will have a single value:
z
|
printLenString | public void printLenString(String v) throws IOException(Code) | | Prints a string to the stream, encoded as UTF-8 with preceeding length
Parameters: v - the string to print. |
printString | public void printString(String v) throws IOException(Code) | | Prints a string to the stream, encoded as UTF-8
Parameters: v - the string to print. |
printString | public void printString(String v, int offset, int length) throws IOException(Code) | | Prints a string to the stream, encoded as UTF-8
Parameters: v - the string to print. |
printString | public void printString(char[] v, int offset, int length) throws IOException(Code) | | Prints a string to the stream, encoded as UTF-8
Parameters: v - the string to print. |
resetReferences | public void resetReferences()(Code) | | Resets the references for streaming.
|
setVersion | public void setVersion(int version)(Code) | | Sets the client's version.
|
startCall | public void startCall(String method) throws IOException(Code) | | Starts the method call. Clients would use startCall
instead of call if they wanted finer control over
writing the arguments, or needed to write headers.
c major minor
m b16 b8 method-name
Parameters: method - the method name to call. |
startCall | public void startCall() throws IOException(Code) | | Writes the call tag. This would be followed by the
headers and the method tag.
c major minor
Parameters: method - the method name to call. |
startReply | public void startReply() throws IOException(Code) | | Starts the reply
A successful completion will have a single value:
r
|
writeBoolean | public void writeBoolean(boolean value) throws IOException(Code) | | Writes a boolean value to the stream. The boolean will be written
with the following syntax:
T
F
Parameters: value - the boolean value to write. |
writeByteBufferEnd | public void writeByteBufferEnd(byte[] buffer, int offset, int length) throws IOException(Code) | | Writes a byte buffer to the stream.
b b16 b18 bytes
|
writeByteBufferPart | public void writeByteBufferPart(byte[] buffer, int offset, int length) throws IOException(Code) | | Writes a byte buffer to the stream.
b b16 b18 bytes
|
writeByteBufferStart | public void writeByteBufferStart() throws IOException(Code) | | Writes a byte buffer to the stream.
|
writeBytes | public void writeBytes(byte[] buffer) throws IOException(Code) | | Writes a byte array to the stream.
The array will be written with the following syntax:
B b16 b18 bytes
If the value is null, it will be written as
N
Parameters: value - the string value to write. |
writeBytes | public void writeBytes(byte[] buffer, int offset, int length) throws IOException(Code) | | Writes a byte array to the stream.
The array will be written with the following syntax:
B b16 b18 bytes
If the value is null, it will be written as
N
Parameters: value - the string value to write. |
writeDouble | public void writeDouble(double value) throws IOException(Code) | | Writes a double value to the stream. The double will be written
with the following syntax:
D b64 b56 b48 b40 b32 b24 b16 b8
Parameters: value - the double value to write. |
writeFault | public void writeFault(String code, String message, Object detail) throws IOException(Code) | | Writes a fault. The fault will be written
as a descriptive string followed by an object:
f
<string>code
<string>the fault code
<string>message
<string>the fault mesage
<string>detail
mt\x00\xnnjavax.ejb.FinderException
...
z
z
Parameters: code - the fault code, a three digit |
writeHeader | public void writeHeader(String name) throws IOException(Code) | | Writes a header name. The header value must immediately follow.
H b16 b8 foo value
|
writeInt | public void writeInt(int value) throws IOException(Code) | | Writes an integer value to the stream. The integer will be written
with the following syntax:
I b32 b24 b16 b8
Parameters: value - the integer value to write. |
writeListBegin | public boolean writeListBegin(int length, String type) throws IOException(Code) | | Writes the list header to the stream. List writers will call
writeListBegin followed by the list contents and then
call writeListEnd .
V
t b16 b8 type
l b32 b24 b16 b8
|
writeListEnd | public void writeListEnd() throws IOException(Code) | | Writes the tail of the list to the stream.
|
writeLong | public void writeLong(long value) throws IOException(Code) | | Writes a long value to the stream. The long will be written
with the following syntax:
L b64 b56 b48 b40 b32 b24 b16 b8
Parameters: value - the long value to write. |
writeMapBegin | public void writeMapBegin(String type) throws IOException(Code) | | Writes the map header to the stream. Map writers will call
writeMapBegin followed by the map contents and then
call writeMapEnd .
Mt b16 b8 ( )z
|
writeMapEnd | public void writeMapEnd() throws IOException(Code) | | Writes the tail of the map to the stream.
|
writeMethod | public void writeMethod(String method) throws IOException(Code) | | Writes the method tag.
m b16 b8 method-name
Parameters: method - the method name to call. |
writeNull | public void writeNull() throws IOException(Code) | | Writes a null value to the stream.
The null will be written with the following syntax
N
Parameters: value - the string value to write. |
writePlaceholder | public void writePlaceholder() throws IOException(Code) | | Writes a placeholder.
P
|
writeRef | public void writeRef(int value) throws IOException(Code) | | Writes a reference.
R b32 b24 b16 b8
Parameters: value - the integer value to write. |
writeRemote | public void writeRemote(String type, String url) throws IOException(Code) | | Writes a remote object reference to the stream. The type is the
type of the remote interface.
'r' 't' b16 b8 type url
|
writeString | public void writeString(String value) throws IOException(Code) | | Writes a string value to the stream using UTF-8 encoding.
The string will be written with the following syntax:
S b16 b8 string-value
If the value is null, it will be written as
N
Parameters: value - the string value to write. |
writeString | public void writeString(char[] buffer, int offset, int length) throws IOException(Code) | | Writes a string value to the stream using UTF-8 encoding.
The string will be written with the following syntax:
S b16 b8 string-value
If the value is null, it will be written as
N
Parameters: value - the string value to write. |
writeUTCDate | public void writeUTCDate(long time) throws IOException(Code) | | Writes a date to the stream.
T b64 b56 b48 b40 b32 b24 b16 b8
Parameters: time - the date in milliseconds from the epoch in UTC |
Methods inherited from com.caucho.hessian.io.AbstractHessianOutput | abstract public boolean addRef(Object object) throws IOException(Code)(Java Doc) public void call(String method, Object[] args) throws IOException(Code)(Java Doc) public void close() throws IOException(Code)(Java Doc) abstract public void completeCall() throws IOException(Code)(Java Doc) public void completeReply() throws IOException(Code)(Java Doc) final public SerializerFactory findSerializerFactory()(Code)(Java Doc) public void flush() throws IOException(Code)(Java Doc) public SerializerFactory getSerializerFactory()(Code)(Java Doc) public void init(OutputStream os)(Code)(Java Doc) abstract public boolean removeRef(Object obj) throws IOException(Code)(Java Doc) abstract public boolean replaceRef(Object oldRef, Object newRef) throws IOException(Code)(Java Doc) public void resetReferences()(Code)(Java Doc) public void setSerializerFactory(SerializerFactory factory)(Code)(Java Doc) abstract public void startCall() throws IOException(Code)(Java Doc) abstract public void startCall(String method) throws IOException(Code)(Java Doc) public void startReply() throws IOException(Code)(Java Doc) abstract public void writeBoolean(boolean value) throws IOException(Code)(Java Doc) abstract public void writeByteBufferEnd(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc) abstract public void writeByteBufferPart(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc) abstract public void writeByteBufferStart() throws IOException(Code)(Java Doc) abstract public void writeBytes(byte[] buffer) throws IOException(Code)(Java Doc) abstract public void writeBytes(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc) public void writeClassFieldLength(int len) throws IOException(Code)(Java Doc) abstract public void writeDouble(double value) throws IOException(Code)(Java Doc) public void writeFault(String code, String message, Object detail) throws IOException(Code)(Java Doc) abstract public void writeHeader(String name) throws IOException(Code)(Java Doc) abstract public void writeInt(int value) throws IOException(Code)(Java Doc) abstract public boolean writeListBegin(int length, String type) throws IOException(Code)(Java Doc) abstract public void writeListEnd() throws IOException(Code)(Java Doc) abstract public void writeLong(long value) throws IOException(Code)(Java Doc) abstract public void writeMapBegin(String type) throws IOException(Code)(Java Doc) abstract public void writeMapEnd() throws IOException(Code)(Java Doc) abstract public void writeMethod(String method) throws IOException(Code)(Java Doc) abstract public void writeNull() throws IOException(Code)(Java Doc) abstract public void writeObject(Object object) throws IOException(Code)(Java Doc) public int writeObjectBegin(String type) throws IOException(Code)(Java Doc) public void writeObjectEnd() throws IOException(Code)(Java Doc) abstract public void writeRef(int value) throws IOException(Code)(Java Doc) abstract public void writeRemote(String type, String url) throws IOException(Code)(Java Doc) abstract public void writeString(String value) throws IOException(Code)(Java Doc) abstract public void writeString(char[] buffer, int offset, int length) throws IOException(Code)(Java Doc) abstract public void writeUTCDate(long time) throws IOException(Code)(Java Doc)
|
|
|