java.lang.Object
net.i2p.router.transport.udp.SSU2Payload.Block
net.i2p.router.transport.udp.SSU2Payload.AddressBlock
- Enclosing class:
SSU2Payload
Block containing IP address and port information. Used to exchange transport addresses.
Field Summary
Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionintReturn the address data length (2 byte port + IP bytes).intwriteData(byte[] tgt, int off) Write the address block data to the target array.Methods inherited from class SSU2Payload.Block
getTotalLength, getType, toString, write
Field Details
i
private final byte[] iThe advertised IP address bytes.p
private final int pThe advertised port.
Constructor Details
AddressBlock
public AddressBlock(byte[] ip, int port) Create an address block.- Parameters:
ip- the IP address bytes (IPv4 = 4 bytes, IPv6 = 16 bytes)port- the port number
Method Details
getDataLength
public int getDataLength()Return the address data length (2 byte port + IP bytes).- Specified by:
getDataLengthin classSSU2Payload.Block- Returns:
- the data length
writeData
public int writeData(byte[] tgt, int off) Write the address 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