类 HessianOutput

  • 直接已知子类:
    HessianSerializerOutput

    public class HessianOutput
    extends AbstractHessianOutput
    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
     
    • 构造器概要

      构造器 
      构造器 说明
      HessianOutput()
      Creates an uninitialized Hessian output stream.
       os)
      Creates a new Hessian output stream, initialized with an underlying output stream.
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      boolean  object)
      If the object has already been written, just write its ref.
      void  method, [] args)
      Writes a complete method call.
      void close()  
      void completeCall()
      Completes.
      void completeReply()
      Completes reading the reply
      void flush()  
      void  os)
      Initializes the output
      void  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  v)
      Prints a string to the stream, encoded as UTF-8
      void  v, int offset, int length)
      Prints a string to the stream, encoded as UTF-8
      boolean  obj)
      Removes a reference.
      boolean  oldRef,  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  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  code,  message,  detail)
      Writes a fault.
      void  name)
      Writes a header name.
      void writeInt​(int value)
      Writes an integer value to the stream.
      boolean writeListBegin​(int length,  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  type)
      Writes the map header to the stream.
      void writeMapEnd()
      Writes the tail of the map to the stream.
      void  method)
      Writes the method tag.
      void writeNull()
      Writes a null value to the stream.
      void  object)
      Writes any object to the output stream.
      void writePlaceholder()
      Writes a placeholder.
      void writeRef​(int value)
      Writes a reference.
      void  type,  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  value)
      Writes a string value to the stream using UTF-8 encoding.
      void writeUTCDate​(long time)
      Writes a date to the stream.
      • 从类继承的方法 java.lang.

        , , , , , , , ,
    • 构造器详细资料

      • HessianOutput

        public HessianOutput​( os)
        Creates a new Hessian output stream, initialized with an underlying output stream.
        参数:
        os - the underlying output stream.
      • HessianOutput

        public HessianOutput()
        Creates an uninitialized Hessian output stream.
    • 方法详细资料

      • setVersion

        public void setVersion​(int version)
        Sets the client's version.
      • call

        public void call​( method,
                         [] args)
                  throws 
        Writes a complete method call.
        覆盖:
        call 在类中 AbstractHessianOutput
        抛出:
      • startCall

        public void startCall​( method,
                              int length)
                       throws 
        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
         
        指定者:
        startCall 在类中 AbstractHessianOutput
        参数:
        method - the method name to call.
        抛出:
      • startCall

        public void startCall()
                       throws 
        Writes the call tag. This would be followed by the headers and the method tag.

         c major minor
         
        指定者:
        startCall 在类中 AbstractHessianOutput
        参数:
        method - the method name to call.
        抛出:
      • writeMethod

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

         m b16 b8 method-name
         
        指定者:
        writeMethod 在类中 AbstractHessianOutput
        参数:
        method - the method name to call.
        抛出:
      • startReply

        public void startReply()
                        throws 
        Starts the reply

        A successful completion will have a single value:

         r
         
        覆盖:
        startReply 在类中 AbstractHessianOutput
        抛出:
      • completeReply

        public void completeReply()
                           throws 
        Completes reading the reply

        A successful completion will have a single value:

         z
         
        覆盖:
        completeReply 在类中 AbstractHessianOutput
        抛出:
      • writeHeader

        public void writeHeader​( name)
                         throws 
        Writes a header name. The header value must immediately follow.

         H b16 b8 foo value
         
        覆盖:
        writeHeader 在类中 AbstractHessianOutput
        抛出:
      • writeFault

        public void writeFault​( code,
                                message,
                                detail)
                        throws 
        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

        覆盖:
        writeFault 在类中 AbstractHessianOutput
        参数:
        code - the fault code, a three digit
        抛出:
      • writeObject

        public void writeObject​( object)
                         throws 
        Writes any object to the output stream.
        指定者:
        writeObject 在类中 AbstractHessianOutput
        抛出:
      • writeListBegin

        public boolean writeListBegin​(int length,
                                       type)
                               throws 
        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
         
        指定者:
        writeListBegin 在类中 AbstractHessianOutput
        抛出:
      • writeMapBegin

        public void writeMapBegin​( type)
                           throws 
        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
         
        指定者:
        writeMapBegin 在类中 AbstractHessianOutput
        抛出:
      • writeRemote

        public void writeRemote​( type,
                                 url)
                         throws 
        Writes a remote object reference to the stream. The type is the type of the remote interface.

         'r' 't' b16 b8 type url
         
        抛出:
      • writeBoolean

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

         T
         F
         
        指定者:
        writeBoolean 在类中 AbstractHessianOutput
        参数:
        value - the boolean value to write.
        抛出:
      • writeInt

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

         I b32 b24 b16 b8
         
        指定者:
        writeInt 在类中 AbstractHessianOutput
        参数:
        value - the integer value to write.
        抛出:
      • writeLong

        public void writeLong​(long value)
                       throws 
        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
         
        指定者:
        writeLong 在类中 AbstractHessianOutput
        参数:
        value - the long value to write.
        抛出:
      • writeDouble

        public void writeDouble​(double value)
                         throws 
        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
         
        指定者:
        writeDouble 在类中 AbstractHessianOutput
        参数:
        value - the double value to write.
        抛出:
      • writeUTCDate

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

         T  b64 b56 b48 b40 b32 b24 b16 b8
         
        指定者:
        writeUTCDate 在类中 AbstractHessianOutput
        参数:
        time - the date in milliseconds from the epoch in UTC
        抛出:
      • writeNull

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

         N
         
        指定者:
        writeNull 在类中 AbstractHessianOutput
        参数:
        value - the string value to write.
        抛出:
      • writeString

        public void writeString​( value)
                         throws 
        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
         
        指定者:
        writeString 在类中 AbstractHessianOutput
        参数:
        value - the string value to write.
        抛出:
      • writeString

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

        public void writeBytes​(byte[] buffer)
                        throws 
        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
         
        指定者:
        writeBytes 在类中 AbstractHessianOutput
        参数:
        value - the string value to write.
        抛出:
      • writeBytes

        public void writeBytes​(byte[] buffer,
                               int offset,
                               int length)
                        throws 
        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
         
        指定者:
        writeBytes 在类中 AbstractHessianOutput
        参数:
        value - the string value to write.
        抛出:
      • writeByteBufferPart

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

         b b16 b18 bytes
         
        指定者:
        writeByteBufferPart 在类中 AbstractHessianOutput
        抛出:
      • writeByteBufferEnd

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

         b b16 b18 bytes
         
        指定者:
        writeByteBufferEnd 在类中 AbstractHessianOutput
        抛出:
      • writeRef

        public void writeRef​(int value)
                      throws 
        Writes a reference.

         R b32 b24 b16 b8
         
        参数:
        value - the integer value to write.
        抛出:
      • writePlaceholder

        public void writePlaceholder()
                              throws 
        Writes a placeholder.

         P
         
        抛出:
      • addRef

        public boolean addRef​( object)
                       throws 
        If the object has already been written, just write its ref.
        指定者:
        addRef 在类中 AbstractHessianOutput
        参数:
        object - the object to add as a reference.
        返回:
        true if we're writing a ref.
        抛出:
      • replaceRef

        public boolean replaceRef​( oldRef,
                                   newRef)
                           throws 
        Replaces a reference from one object to another.
        指定者:
        replaceRef 在类中 AbstractHessianOutput
        抛出:
      • printLenString

        public void printLenString​( v)
                            throws 
        Prints a string to the stream, encoded as UTF-8 with preceeding length
        参数:
        v - the string to print.
        抛出:
      • printString

        public void printString​( v)
                         throws 
        Prints a string to the stream, encoded as UTF-8
        参数:
        v - the string to print.
        抛出:
      • printString

        public void printString​( v,
                                int offset,
                                int length)
                         throws 
        Prints a string to the stream, encoded as UTF-8
        参数:
        v - the string to print.
        抛出:
      • printString

        public void printString​(char[] v,
                                int offset,
                                int length)
                         throws 
        Prints a string to the stream, encoded as UTF-8
        参数:
        v - the string to print.
        抛出: