com.tibbo.aggregate.common.protocol

## Class DefaultCommandWriter<C extends Command>

- java.lang.Object
- - com.tibbo.aggregate.common.protocol.DefaultCommandWriter<C>

- All Implemented Interfaces:
    CommandWriter<C>
  Direct Known Subclasses:
    CompressedCommandWriter

      public class DefaultCommandWriter<C extends Command>
      extends java.lang.Object
      implements CommandWriter<C>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCommandWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.nio.ByteBuffer` | `composeByteBuffer(C command, BlockingChannel channel, java.util.function.Function<C,byte[]> commandBodyExtractor)`
    `void` | `log(C command, ProtocolVersion protocolVersion)`
    `void` | `setVersion(ProtocolVersion version)`
    `void` | `setVersionAfterNextWrite(ProtocolVersion version)`
    `void` | `write(C command, BlockingChannel channel, boolean needsFlushing)`
    `void` | `writeBufferToChannel(java.nio.ByteBuffer buff, C command, BlockingChannel channel, boolean needsFlushing)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.tibbo.aggregate.common.communication.CommandWriter

      `write`

- - ### Constructor Detail

    - #### DefaultCommandWriter

          public DefaultCommandWriter()

  - ### Method Detail

    - #### write

          public void write(C command,
                            BlockingChannel channel,
                            boolean needsFlushing)
                     throws java.io.IOException,
                            DisconnectionException

      Specified by:
        `write` in interface `CommandWriter<C extends Command>`
      Throws:
        `java.io.IOException`
        `DisconnectionException`

    - #### composeByteBuffer

          protected java.nio.ByteBuffer composeByteBuffer(C command,
                                                          BlockingChannel channel,
                                                          java.util.function.Function<C,byte[]> commandBodyExtractor)
                                                   throws DisconnectionException

      Throws:
        `DisconnectionException`

    - #### writeBufferToChannel

          public void writeBufferToChannel(java.nio.ByteBuffer buff,
                                           C command,
                                           BlockingChannel channel,
                                           boolean needsFlushing)
                                    throws DisconnectionException,
                                           java.io.IOException

      Throws:
        `DisconnectionException`
        `java.io.IOException`

    - #### setVersion

          public void setVersion(ProtocolVersion version)

      Specified by:
        `setVersion` in interface `CommandWriter<C extends Command>`

    - #### setVersionAfterNextWrite

          public void setVersionAfterNextWrite(ProtocolVersion version)

      Specified by:
        `setVersionAfterNextWrite` in interface `CommandWriter<C extends Command>`

    - #### log

          public void log(C command,
                          ProtocolVersion protocolVersion)