java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Payload.Block
net.i2p.router.transport.ntcp.NTCP2Payload.PaddingBlock
Enclosing class:
NTCP2Payload

public static class NTCP2Payload.PaddingBlockextends NTCP2Payload.Block
Block containing padding data.
  • Field Details

    • sz

      private int sz
      Size of the padding, in bytes.
    • ctx

      private final I2PAppContext ctx
      The app context.
  • Constructor Details

    • PaddingBlock

      public PaddingBlock(int size)
      With zero-filled data.
      Parameters:
      size - number of padding bytes to write, not counting the 3-byte header
    • PaddingBlock

      public PaddingBlock(I2PAppContext context, int size)
      With random data.
      Parameters:
      context - supplies the random source for the padding, null to zero-fill
      size - number of padding bytes to write, not counting the 3-byte header
  • Method Details

    • setSize

      void setSize(int size)
      Set the size, for reuse of a pooled block.
      Parameters:
      size - number of padding bytes to write, not counting the 3-byte header
    • getDataLength

      public int getDataLength()
      The data length of this block.
      Specified by:
      getDataLength in class NTCP2Payload.Block
      Returns:
      the data length
    • writeData

      public int writeData(byte[] tgt, int off)
      Write the block data to the target array.
      Specified by:
      writeData in class NTCP2Payload.Block
      Parameters:
      tgt - the destination array
      off - index in tgt to write the data at, past the 3-byte header
      Returns:
      the offset just past the written data