public class HessianOutput extends AbstractHessianOutput
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
 | Modifier and Type | Field and Description | 
|---|---|
| protected java.io.OutputStream | os | 
_serializerFactory| Constructor and Description | 
|---|
| HessianOutput()Creates an uninitialized Hessian output stream. | 
| HessianOutput(java.io.OutputStream os)Creates a new Hessian output stream, initialized with an
 underlying output stream. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | addRef(java.lang.Object object)If the object has already been written, just write its ref. | 
| void | call(java.lang.String method,
    java.lang.Object[] args)Writes a complete method call. | 
| void | close() | 
| void | completeCall()Completes. | 
| void | completeReply()Completes reading the reply | 
| void | flush() | 
| int | getRef(java.lang.Object obj) | 
| void | init(java.io.OutputStream os)Initializes the output | 
| void | printLenString(java.lang.String v)Prints a string to the stream, encoded as UTF-8 with preceeding length | 
| void | printString(char[] v,
           int offset,
           int length)Prints a string to the stream, encoded as UTF-8 | 
| 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 | 
| boolean | removeRef(java.lang.Object obj)Removes a reference. | 
| boolean | replaceRef(java.lang.Object oldRef,
          java.lang.Object newRef)Replaces a reference from one object to another. | 
| void | resetReferences()Resets the references for streaming. | 
| void | setVersion(int version)Sets the client's version. | 
| void | startCall()Writes the call tag. | 
| void | startCall(java.lang.String method,
         int length)Starts the method call. | 
| void | startReply()Starts the reply | 
| void | writeBoolean(boolean value)Writes a boolean value to the stream. | 
| void | writeByteBufferEnd(byte[] buffer,
                  int offset,
                  int length)Writes a byte buffer to the stream. | 
| void | writeByteBufferPart(byte[] buffer,
                   int offset,
                   int length)Writes a byte buffer to the stream. | 
| void | writeByteBufferStart()Writes a byte buffer 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 | writeDouble(double value)Writes a double value to the stream. | 
| void | writeFault(java.lang.String code,
          java.lang.String message,
          java.lang.Object detail)Writes a fault. | 
| void | writeHeader(java.lang.String name)Writes a header name. | 
| void | writeInt(int value)Writes an integer value to the stream. | 
| boolean | 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 | writeMethod(java.lang.String method)Writes the method tag. | 
| void | writeNull()Writes a null value to the stream. | 
| void | writeObject(java.lang.Object object)Writes any object to the output stream. | 
| void | writePlaceholder()Writes a placeholder. | 
| 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(char[] buffer,
           int offset,
           int length)Writes a string value to the stream using UTF-8 encoding. | 
| 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. | 
findSerializerFactory, getSerializerFactory, setSerializerFactory, setUnshared, writeByteStream, writeClassFieldLength, writeObjectBegin, writeObjectEnd, writeReplypublic HessianOutput(java.io.OutputStream os)
os - the underlying output stream.public HessianOutput()
public void init(java.io.OutputStream os)
init in class AbstractHessianOutputpublic void setVersion(int version)
public void call(java.lang.String method,
                 java.lang.Object[] args)
          throws java.io.IOException
call in class AbstractHessianOutputjava.io.IOExceptionpublic void startCall(java.lang.String method,
                      int length)
               throws java.io.IOException
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
 
startCall in class AbstractHessianOutputmethod - the method name to call.java.io.IOExceptionpublic void startCall()
               throws java.io.IOException
 c major minor
 
startCall in class AbstractHessianOutputmethod - the method name to call.java.io.IOExceptionpublic void writeMethod(java.lang.String method)
                 throws java.io.IOException
 m b16 b8 method-name
 
writeMethod in class AbstractHessianOutputmethod - the method name to call.java.io.IOExceptionpublic void completeCall()
                  throws java.io.IOException
 z
 
completeCall in class AbstractHessianOutputjava.io.IOExceptionpublic void startReply()
                throws java.io.IOException
A successful completion will have a single value:
r
startReply in class AbstractHessianOutputjava.io.IOExceptionpublic void completeReply()
                   throws java.io.IOException
A successful completion will have a single value:
z
completeReply in class AbstractHessianOutputjava.io.IOExceptionpublic void writeHeader(java.lang.String name)
                 throws java.io.IOException
 H b16 b8 foo value
 
writeHeader in class AbstractHessianOutputjava.io.IOExceptionpublic void writeFault(java.lang.String code,
                       java.lang.String message,
                       java.lang.Object detail)
                throws java.io.IOException
 f
 <string>code
 <string>the fault code
 <string>message
 <string>the fault mesage
 <string>detail
 mt\x00\xnnjavax.ejb.FinderException
     ...
 z
 z
 writeFault in class AbstractHessianOutputcode - the fault code, a three digitjava.io.IOExceptionpublic void writeObject(java.lang.Object object)
                 throws java.io.IOException
writeObject in class AbstractHessianOutputjava.io.IOExceptionpublic boolean writeListBegin(int length,
                              java.lang.String type)
                       throws java.io.IOException
writeListBegin followed by the list contents and then
 call writeListEnd.
 
 V
 t b16 b8 type
 l b32 b24 b16 b8
 
writeListBegin in class AbstractHessianOutputjava.io.IOExceptionpublic void writeListEnd()
                  throws java.io.IOException
writeListEnd in class AbstractHessianOutputjava.io.IOExceptionpublic void writeMapBegin(java.lang.String type)
                   throws java.io.IOException
writeMapBegin followed by the map contents and then
 call writeMapEnd.
 
 Mt b16 b8 ( )z
   
writeMapBegin in class AbstractHessianOutputjava.io.IOExceptionpublic void writeMapEnd()
                 throws java.io.IOException
writeMapEnd in class AbstractHessianOutputjava.io.IOExceptionpublic void writeRemote(java.lang.String type,
                        java.lang.String url)
                 throws java.io.IOException
 'r' 't' b16 b8 type url
 
java.io.IOExceptionpublic void writeBoolean(boolean value)
                  throws java.io.IOException
 T
 F
 
writeBoolean in class AbstractHessianOutputvalue - the boolean value to write.java.io.IOExceptionpublic void writeInt(int value)
              throws java.io.IOException
 I b32 b24 b16 b8
 
writeInt in class AbstractHessianOutputvalue - the integer value to write.java.io.IOExceptionpublic void writeLong(long value)
               throws java.io.IOException
 L b64 b56 b48 b40 b32 b24 b16 b8
 
writeLong in class AbstractHessianOutputvalue - the long value to write.java.io.IOExceptionpublic void writeDouble(double value)
                 throws java.io.IOException
 D b64 b56 b48 b40 b32 b24 b16 b8
 
writeDouble in class AbstractHessianOutputvalue - the double value to write.java.io.IOExceptionpublic void writeUTCDate(long time)
                  throws java.io.IOException
 T  b64 b56 b48 b40 b32 b24 b16 b8
 
writeUTCDate in class AbstractHessianOutputtime - the date in milliseconds from the epoch in UTCjava.io.IOExceptionpublic void writeNull()
               throws java.io.IOException
 N
 
writeNull in class AbstractHessianOutputvalue - the string value to write.java.io.IOExceptionpublic void writeString(java.lang.String value)
                 throws java.io.IOException
 S b16 b8 string-value
 
 N
 
writeString in class AbstractHessianOutputvalue - the string value to write.java.io.IOExceptionpublic void writeString(char[] buffer,
                        int offset,
                        int length)
                 throws java.io.IOException
 S b16 b8 string-value
 
 N
 
writeString in class AbstractHessianOutputvalue - the string value to write.java.io.IOExceptionpublic void writeBytes(byte[] buffer)
                throws java.io.IOException
 B b16 b18 bytes
 
 N
 
writeBytes in class AbstractHessianOutputvalue - the string value to write.java.io.IOExceptionpublic void writeBytes(byte[] buffer,
                       int offset,
                       int length)
                throws java.io.IOException
 B b16 b18 bytes
 
 N
 
writeBytes in class AbstractHessianOutputvalue - the string value to write.java.io.IOExceptionpublic void writeByteBufferStart()
                          throws java.io.IOException
 
writeByteBufferStart in class AbstractHessianOutputjava.io.IOExceptionpublic void writeByteBufferPart(byte[] buffer,
                                int offset,
                                int length)
                         throws java.io.IOException
 b b16 b18 bytes
 
writeByteBufferPart in class AbstractHessianOutputjava.io.IOExceptionpublic void writeByteBufferEnd(byte[] buffer,
                               int offset,
                               int length)
                        throws java.io.IOException
 b b16 b18 bytes
 
writeByteBufferEnd in class AbstractHessianOutputjava.io.IOExceptionpublic void writeRef(int value)
              throws java.io.IOException
 R b32 b24 b16 b8
 
writeRef in class AbstractHessianOutputvalue - the integer value to write.java.io.IOExceptionpublic void writePlaceholder()
                      throws java.io.IOException
 P
 
java.io.IOExceptionpublic boolean addRef(java.lang.Object object)
               throws java.io.IOException
addRef in class AbstractHessianOutputobject - the object to add as a reference.java.io.IOExceptionpublic int getRef(java.lang.Object obj)
getRef in class AbstractHessianOutputpublic void resetReferences()
resetReferences in class AbstractHessianOutputpublic boolean removeRef(java.lang.Object obj)
                  throws java.io.IOException
removeRef in class AbstractHessianOutputjava.io.IOExceptionpublic boolean replaceRef(java.lang.Object oldRef,
                          java.lang.Object newRef)
                   throws java.io.IOException
replaceRef in class AbstractHessianOutputjava.io.IOExceptionpublic void printLenString(java.lang.String v)
                    throws java.io.IOException
v - the string to print.java.io.IOExceptionpublic void printString(java.lang.String v)
                 throws java.io.IOException
v - the string to print.java.io.IOExceptionpublic void printString(java.lang.String v,
                        int offset,
                        int length)
                 throws java.io.IOException
v - the string to print.java.io.IOExceptionpublic void printString(char[] v,
                        int offset,
                        int length)
                 throws java.io.IOException
v - the string to print.java.io.IOExceptionpublic void flush()
           throws java.io.IOException
flush in class AbstractHessianOutputjava.io.IOExceptionpublic void close()
           throws java.io.IOException
close in class AbstractHessianOutputjava.io.IOException