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 blocks to be transmitted. Not used for receive; we use callbacks instead.
  • Constructor Details

    • Block

      public Block(int ttype)
  • Method Details

    • write

      public int write(byte[] tgt, int off)
      Returns:
      new offset
    • getTotalLength

      public int getTotalLength()
      Returns:
      the size of the block, including the 3 byte header (type and size)
    • getDataLength

      public abstract int getDataLength()
      Returns:
      the size of the block, NOT including the 3 byte header (type and size)
    • writeData

      public abstract int writeData(byte[] tgt, int off)
      Returns:
      new offset
    • toString

      public String toString()
      Overrides:
      toString in class Object