java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Payload.Block
net.i2p.router.transport.ntcp.NTCP2Payload.RIBlock
- Enclosing class:
NTCP2Payload
Block containing router information.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionRIBlock(RouterInfo ri, boolean flood) Serializes the RouterInfo and records whether the receiver should flood it.Method Summary
All MethodsModifier and TypeMethodDescriptionintThe data length of this block.intwriteData(byte[] tgt, int off) Write the block data to the target array.Methods inherited from class NTCP2Payload.Block
getTotalLength, toString, write
Field Details
data
private final byte[] dataThe encoded router info.f
private final boolean fTrue if the receiver should flood the router info.
Constructor Details
RIBlock
Serializes the RouterInfo and records whether the receiver should flood it.- Parameters:
ri- the RouterInfo to serialize into the blockflood- true to set the flag byte asking the receiver to flood it
Method Details
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