java.lang.Object
net.i2p.router.crypto.ratchet.RatchetPayload.Block
- Direct Known Subclasses:
RatchetPayload.AckBlock, RatchetPayload.AckRequestBlock, RatchetPayload.DateTimeBlock, RatchetPayload.GarlicBlock, RatchetPayload.NextKeyBlock, RatchetPayload.OptionsBlock, RatchetPayload.PaddingBlock, RatchetPayload.PNBlock, RatchetPayload.TerminationBlock
- Enclosing class:
RatchetPayload
Base class for blocks to be transmitted. Not used for receive; we use callbacks instead.
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
Field Details
type
private final int typeType of the block being read or written.
Constructor Details
Block
public Block(int ttype) Block of the given type.- Parameters:
ttype- the block type
Method Details
write
public int write(byte[] tgt, int off) Writes the block header and data to the target.- Parameters:
tgt- the buffer the 3 byte header and the block data are written intooff- the offset in tgt where the header starts- Returns:
- the offset just past the block data written to tgt
getTotalLength
public int getTotalLength()Total size of the block.- Returns:
- the size of the block, including the 3 byte header (type and size)
getDataLength
public abstract int getDataLength()Data size of the block.- Returns:
- the size of the block, NOT including the 3 byte header (type and size)
writeData
public abstract int writeData(byte[] tgt, int off) Write the block data.- Parameters:
tgt- the target bufferoff- the offset in tgt where the block data starts- Returns:
- the offset just past the data written to tgt
toString