Class DefaultWriteRequest

    • Field Detail

      • EMPTY_MESSAGE

        public static final byte[] EMPTY_MESSAGE
        An empty message
    • Constructor Detail

      • DefaultWriteRequest

        public DefaultWriteRequest​(java.lang.Object message)
        Creates a new instance without WriteFuture. You'll get an instance of WriteFuture even if you called this constructor because getFuture() will return a bogus future.
        Parameters:
        message - The message that will be written
      • DefaultWriteRequest

        public DefaultWriteRequest​(java.lang.Object message,
                                   WriteFuture future)
        Creates a new instance with WriteFuture.
        Parameters:
        message - The message that will be written
        future - The associated WriteFuture
      • DefaultWriteRequest

        public DefaultWriteRequest​(java.lang.Object message,
                                   WriteFuture future,
                                   java.net.SocketAddress destination)
        Creates a new instance.
        Parameters:
        message - a message to write
        future - a future that needs to be notified when an operation is finished
        destination - the destination of the message. This property will be ignored unless the transport supports it.
    • Method Detail

      • getMessage

        public java.lang.Object getMessage()
        Specified by:
        getMessage in interface WriteRequest
        Returns:
        a message object to be written.
      • setMessage

        public void setMessage​(java.lang.Object modifiedMessage)
        Set the modified message after it has been processed by a filter.
        Specified by:
        setMessage in interface WriteRequest
        Parameters:
        modifiedMessage - The modified message
      • getOriginalMessage

        public java.lang.Object getOriginalMessage()
        Specified by:
        getOriginalMessage in interface WriteRequest
        Returns:
        the original message which was sent to the session, before any filter transformation.
      • getDestination

        public java.net.SocketAddress getDestination()
        Returns the destination of this write request.
        Specified by:
        getDestination in interface WriteRequest
        Returns:
        null for the default destination
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isEncoded

        public boolean isEncoded()
        Tells if the current message has been encoded
        Specified by:
        isEncoded in interface WriteRequest
        Returns:
        true if the message has already been encoded