java.lang.Object
net.i2p.router.transport.udp.SSU2Payload.Block
net.i2p.router.transport.udp.SSU2Payload.PaddingBlock
Enclosing class:
SSU2Payload

public static class SSU2Payload.PaddingBlockextends SSU2Payload.Block
Block containing padding data. Used to pad messages to required sizes.
  • Field Details

    • sz

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

      private final I2PAppContext ctx
      The app context for the padding size.
  • Constructor Details

    • PaddingBlock

      public PaddingBlock(int size)
      Create a padding block with zero-filled data.
      Parameters:
      size - the padding size
    • PaddingBlock

      public PaddingBlock(I2PAppContext context, int size)
      Create a padding block with random data.
      Parameters:
      context - the I2P context for random data generation
      size - the padding size
  • Method Details

    • getDataLength

      public int getDataLength()
      Return the padding size.
      Specified by:
      getDataLength in class SSU2Payload.Block
      Returns:
      the padding size
    • writeData

      public int writeData(byte[] tgt, int off)
      Write the padding block data to the target array.
      Specified by:
      writeData in class SSU2Payload.Block
      Parameters:
      tgt - target array to write to
      off - offset in the target array
      Returns:
      the new offset after writing