类 AbstractHessianOutput

  • 直接已知子类:
    Hessian2Output, HessianOutput

    public abstract class AbstractHessianOutput
    extends Object
    Abstract output stream for Hessian requests.

     OutputStream os = ...; // from http connection
     AbstractOutput out = new HessianSerializerOutput(os);
     String value;
    
     out.startCall("hello");  // start hello call
     out.writeString("arg1"); // write a string argument
     out.completeCall();      // complete the call
     
    • 构造器详细资料

      • AbstractHessianOutput

        public AbstractHessianOutput()
    • 方法详细资料

      • getSerializerFactory

        public SerializerFactory getSerializerFactory()
        Gets the serializer factory.
      • setSerializerFactory

        public void setSerializerFactory​(SerializerFactory factory)
        Sets the serializer factory.
      • findSerializerFactory

        public final SerializerFactory findSerializerFactory()
        Gets the serializer factory.
      • init

        public void init​(OutputStream os)
        Initialize the output with a new underlying stream.
      • startCall

        public abstract void startCall()
                                throws IOException
        Starts the method call:

         C
         
        参数:
        method - the method name to call.
        抛出:
        IOException
      • startCall

        public abstract void startCall​(String method,
                                       int length)
                                throws IOException
        Starts the method call:

         C string int
         
        参数:
        method - the method name to call.
        抛出:
        IOException
      • writeHeader

        public void writeHeader​(String name)
                         throws IOException
        已过时。
        For Hessian 2.0, use the Header envelope instead
        抛出:
        IOException
      • writeMethod

        public abstract void writeMethod​(String method)
                                  throws IOException
        Writes the method tag.

         string
         
        参数:
        method - the method name to call.
        抛出:
        IOException
      • completeCall

        public abstract void completeCall()
                                   throws IOException
        Completes the method call:

         
        抛出:
        IOException
      • writeBoolean

        public abstract void writeBoolean​(boolean value)
                                   throws IOException
        Writes a boolean value to the stream. The boolean will be written with the following syntax:

         T
         F
         
        参数:
        value - the boolean value to write.
        抛出:
        IOException
      • writeInt

        public abstract void writeInt​(int value)
                               throws IOException
        Writes an integer value to the stream. The integer will be written with the following syntax:

         I b32 b24 b16 b8
         
        参数:
        value - the integer value to write.
        抛出:
        IOException
      • writeLong

        public abstract void writeLong​(long value)
                                throws IOException
        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
         
        参数:
        value - the long value to write.
        抛出:
        IOException
      • writeDouble

        public abstract void writeDouble​(double value)
                                  throws IOException
        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
         
        参数:
        value - the double value to write.
        抛出:
        IOException
      • writeUTCDate

        public abstract void writeUTCDate​(long time)
                                   throws IOException
        Writes a date to the stream.

         T  b64 b56 b48 b40 b32 b24 b16 b8
         
        参数:
        time - the date in milliseconds from the epoch in UTC
        抛出:
        IOException
      • writeNull

        public abstract void writeNull()
                                throws IOException
        Writes a null value to the stream. The null will be written with the following syntax

         N
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • writeString

        public abstract void writeString​(String value)
                                  throws IOException
        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
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • writeString

        public abstract void writeString​(char[] buffer,
                                         int offset,
                                         int length)
                                  throws IOException
        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
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • writeBytes

        public abstract void writeBytes​(byte[] buffer)
                                 throws IOException
        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
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • writeBytes

        public abstract void writeBytes​(byte[] buffer,
                                        int offset,
                                        int length)
                                 throws IOException
        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
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • writeByteBufferStart

        public abstract void writeByteBufferStart()
                                           throws IOException
        Writes a byte buffer to the stream.
        抛出:
        IOException
      • writeByteBufferPart

        public abstract void writeByteBufferPart​(byte[] buffer,
                                                 int offset,
                                                 int length)
                                          throws IOException
        Writes a byte buffer to the stream.

         b b16 b18 bytes
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • writeByteBufferEnd

        public abstract void writeByteBufferEnd​(byte[] buffer,
                                                int offset,
                                                int length)
                                         throws IOException
        Writes the last chunk of a byte buffer to the stream.

         b b16 b18 bytes
         
        参数:
        value - the string value to write.
        抛出:
        IOException
      • replaceRef

        public abstract boolean replaceRef​(Object oldRef,
                                           Object newRef)
                                    throws IOException
        Replaces a reference from one object to another.
        抛出:
        IOException
      • addRef

        public abstract boolean addRef​(Object object)
                                throws IOException
        Adds an object to the reference list. If the object already exists, writes the reference, otherwise, the caller is responsible for the serialization.

         R b32 b24 b16 b8
         
        参数:
        object - the object to add as a reference.
        返回:
        true if the object has already been written.
        抛出:
        IOException
      • resetReferences

        public void resetReferences()
        Resets the references for streaming.
      • writeObject

        public abstract void writeObject​(Object object)
                                  throws IOException
        Writes a generic object to the output stream.
        抛出:
        IOException
      • writeListBegin

        public abstract boolean writeListBegin​(int length,
                                               String type)
                                        throws IOException
        Writes the list header to the stream. List writers will call writeListBegin followed by the list contents and then call writeListEnd.

         V
           x13 java.util.ArrayList   # type
           x93                       # length=3
           x91                       # 1
           x92                       # 2
           x93                       # 3
         </list>
         
        抛出:
        IOException
      • writeListEnd

        public abstract void writeListEnd()
                                   throws IOException
        Writes the tail of the list to the stream.
        抛出:
        IOException
      • writeMapBegin

        public abstract void writeMapBegin​(String type)
                                    throws IOException
        Writes the map header to the stream. Map writers will call writeMapBegin followed by the map contents and then call writeMapEnd.

         M type ( )* Z
         
        抛出:
        IOException
      • writeMapEnd

        public abstract void writeMapEnd()
                                  throws IOException
        Writes the tail of the map to the stream.
        抛出:
        IOException
      • writeObjectBegin

        public int writeObjectBegin​(String type)
                             throws IOException
        Writes the object header to the stream (for Hessian 2.0), or a Map for Hessian 1.0. Object writers will call writeObjectBegin followed by the map contents and then call writeObjectEnd.

         C type int *
         C int *
         
        返回:
        true if the object has already been defined.
        抛出:
        IOException
      • writeClassFieldLength

        public void writeClassFieldLength​(int len)
                                   throws IOException
        Writes the end of the class.
        抛出:
        IOException
      • writeObjectEnd

        public void writeObjectEnd()
                            throws IOException
        Writes the tail of the object to the stream.
        抛出:
        IOException