java.lang.Object
net.i2p.router.transport.udp.SSU2Payload.Block
net.i2p.router.transport.udp.SSU2Payload.PaddingBlock
- Enclosing class:
SSU2Payload
Block containing padding data. Used to pad messages to required sizes.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe app context for the padding size.private final intLength of the padding, in bytes.Constructor Summary
ConstructorsConstructorDescriptionPaddingBlock(int size) Create a padding block with zero-filled data.PaddingBlock(I2PAppContext context, int size) Create a padding block with random data.Method Summary
All MethodsModifier and TypeMethodDescriptionintReturn the padding size.intwriteData(byte[] tgt, int off) Write the padding block data to the target array.Methods inherited from class SSU2Payload.Block
getTotalLength, getType, toString, write
Field Details
sz
private final int szLength of the padding, in bytes.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
Create a padding block with random data.- Parameters:
context- the I2P context for random data generationsize- the padding size
Method Details
getDataLength
public int getDataLength()Return the padding size.- Specified by:
getDataLengthin classSSU2Payload.Block- Returns:
- the padding size
writeData
public int writeData(byte[] tgt, int off) Write the padding block data to the target array.- Specified by:
writeDatain classSSU2Payload.Block- Parameters:
tgt- target array to write tooff- offset in the target array- Returns:
- the new offset after writing