java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Payload.Block
net.i2p.router.transport.ntcp.NTCP2Payload.PaddingBlock
- Enclosing class:
NTCP2Payload
Block containing padding data.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe app context.private intSize of the padding, in bytes.Constructor Summary
ConstructorsConstructorDescriptionPaddingBlock(int size) With zero-filled data.PaddingBlock(I2PAppContext context, int size) With random data.Method Summary
Public MethodsMethods inherited from class NTCP2Payload.Block
getTotalLength, toString, write
Field Details
sz
private int szSize of the padding, in bytes.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
With random data.- Parameters:
context- supplies the random source for the padding, null to zero-fillsize- 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:
getDataLengthin classNTCP2Payload.Block- Returns:
- the data length
writeData
public int writeData(byte[] tgt, int off) Write the block data to the target array.- Specified by:
writeDatain classNTCP2Payload.Block- Parameters:
tgt- the destination arrayoff- index in tgt to write the data at, past the 3-byte header- Returns:
- the offset just past the written data