Class MessageLiteral

  • All Implemented Interfaces:
    Literal

    class MessageLiteral
    extends java.lang.Object
    implements Literal
    An object that holds a Message object and reports its size and writes it to another OutputStream on demand. Used by appendMessages to avoid the need to buffer the entire message in memory in a single byte array before sending it to the server.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] buf  
      private Message msg  
      private int msgSize  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int size()
      Return the size of the data.
      void writeTo​(java.io.OutputStream os)
      Write the data to the OutputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • msgSize

        private int msgSize
      • buf

        private byte[] buf
    • Method Detail

      • size

        public int size()
        Description copied from interface: Literal
        Return the size of the data.
        Specified by:
        size in interface Literal
        Returns:
        the size of the data
      • writeTo

        public void writeTo​(java.io.OutputStream os)
                     throws java.io.IOException
        Description copied from interface: Literal
        Write the data to the OutputStream.
        Specified by:
        writeTo in interface Literal
        Parameters:
        os - the output stream
        Throws:
        java.io.IOException - for I/O errors