net.i2p.router.transport.ntcp

## Class NTCP2Payload.Block

- java.lang.Object
- - net.i2p.router.transport.ntcp.NTCP2Payload.Block

- Direct Known Subclasses:
    NTCP2Payload.DateTimeBlock, NTCP2Payload.I2NPBlock, NTCP2Payload.OptionsBlock, NTCP2Payload.PaddingBlock, NTCP2Payload.RIBlock, NTCP2Payload.TerminationBlock
  Enclosing class:
    NTCP2Payload

      public abstract static class NTCP2Payload.Block
      extends Object

  Base class for NTCP 2 payload blocks.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Block(int ttype)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `getDataLength()`
    `int` | `getTotalLength()`
    `String` | `toString()`
    `int` | `write(byte[] tgt, int off)`
    `abstract int` | `writeData(byte[] tgt, int off)`

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

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

- - ### Constructor Detail

    - #### Block

          public Block(int ttype)

  - ### Method Detail

    - #### getDataLength

          public abstract int getDataLength()

      Returns:
        the size of the block, NOT including the 3 byte header (type and size)

    - #### getTotalLength

          public int getTotalLength()

      Returns:
        the size of the block, including the 3 byte header (type and size)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### write

          public int write(byte[] tgt,
                           int off)

      Returns:
        new offset

    - #### writeData

          public abstract int writeData(byte[] tgt,
                                        int off)

      Returns:
        new offset