java.lang.Object
net.i2p.data.DataStructureImpl
net.i2p.data.i2np.DeliveryInstructions
net.i2p.data.i2np.DeliveryInstructions.LocalInstructions
- All Implemented Interfaces:
Serializable, DataStructure
- Enclosing class:
DeliveryInstructions
An immutable local delivery instructions with no options for efficiency.
Field Summary
Fields inherited from class DeliveryInstructions
DELIVERY_MODE_DESTINATION, DELIVERY_MODE_LOCAL, DELIVERY_MODE_ROUTER, DELIVERY_MODE_TUNNEL, LOCALModifier and TypeFieldDescriptionstatic final intDelivery mode sending the message to a destination's client.static final intDelivery mode keeping the message on this router.static final intDelivery mode sending the message to a router's transport.static final intDelivery mode sending the message into a named tunnel.static final DeliveryInstructionsImmutable local instructions, no options.Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLocal delivery with no options, the mode fixed to LOCAL.Method Summary
All MethodsModifier and TypeMethodDescriptionintDelivery mode for this local delivery.intgetSize()Local delivery serializes to a single flag byte.intreadBytes(byte[] data, int offset) Throws, as local delivery instructions are immutable.voidsetDelayRequested(boolean req) Throws, as local delivery instructions are immutable.voidsetDelaySeconds(long seconds) Throws, as local delivery instructions are immutable.voidsetDeliveryMode(int mode) Throws, as local delivery instructions are immutable.voidsetDestination(Hash dest) Throws, as local delivery instructions are immutable.voidThrows, as local delivery instructions are immutable.voidsetTunnelId(TunnelId id) Throws, as local delivery instructions are immutable.toString()String form for debugging.intwriteBytes(byte[] target, int offset) Writes the zero flag byte, as local delivery has no additional info.Methods inherited from class DeliveryInstructions
create, equals, getDelayRequested, getDelaySeconds, getDestination, getEncryptionKey, getRouter, getTunnelId, hashCode, readBytes, writeBytesModifier and TypeMethodDescriptionstatic DeliveryInstructionscreate(byte[] data, int offset) Returns immutable local instructions, or new.booleanCompare the delivery instructions for equality, including mode, delay, and target fields.booleanDefaults to false.longDefaults to 0.Default null.For cloves only (not tunnels), default null Unused — always returns null, feature not implemented.Default null.Default null.inthashCode()Hash code combining the delay, mode, and target fields.voidreadBytes(InputStream in) Not supported, use readBytes(byte[], int).voidwriteBytes(OutputStream out) Not supported, use writeBytes(byte[], int).Methods inherited from class DataStructureImpl
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArrayModifier and TypeMethodDescriptionCalculate the SHA256 value of this object (useful for a few scenarios).voidfromBase64(String data) Load the structure from the provided base64 string.voidfromByteArray(byte[] data) Loads structure from the data providedprotected intread(InputStream in, byte[] target) Repeated reads until buffer is full or IOException is thrown.toBase64()Render the structure into modified base 64 notation.byte[]Convert the structure to a byte array.
Constructor Details
LocalInstructions
private LocalInstructions()Local delivery with no options, the mode fixed to LOCAL.
Method Details
getDeliveryMode
public int getDeliveryMode()Delivery mode for this local delivery.- Overrides:
getDeliveryModein classDeliveryInstructions- Returns:
- the delivery mode
setDeliveryMode
public void setDeliveryMode(int mode) Throws, as local delivery instructions are immutable.- Overrides:
setDeliveryModein classDeliveryInstructions- Parameters:
mode- 0-3
setDestination
Throws, as local delivery instructions are immutable.- Overrides:
setDestinationin classDeliveryInstructions- Parameters:
dest- the destination to deliver to
setRouter
Throws, as local delivery instructions are immutable.- Overrides:
setRouterin classDeliveryInstructions- Parameters:
router- the router to deliver to
setTunnelId
Throws, as local delivery instructions are immutable.- Overrides:
setTunnelIdin classDeliveryInstructions- Parameters:
id- the tunnel to deliver to
setDelayRequested
public void setDelayRequested(boolean req) Throws, as local delivery instructions are immutable.- Overrides:
setDelayRequestedin classDeliveryInstructions- Parameters:
req- true to request delayed delivery; the request is stored but never acted on
setDelaySeconds
public void setDelaySeconds(long seconds) Throws, as local delivery instructions are immutable.- Overrides:
setDelaySecondsin classDeliveryInstructions- Parameters:
seconds- the delay to request, in seconds; stored but never acted on
readBytes
public int readBytes(byte[] data, int offset) Throws, as local delivery instructions are immutable.- Overrides:
readBytesin classDeliveryInstructions- Parameters:
data- the buffer holding the encoded delivery instructionsoffset- the index within data of the flags byte starting the instructions- Returns:
- the number of bytes read
writeBytes
public int writeBytes(byte[] target, int offset) Writes the zero flag byte, as local delivery has no additional info.- Overrides:
writeBytesin classDeliveryInstructions- Parameters:
target- the buffer to serialize intooffset- the index within target of the first byte written- Returns:
- the number of bytes written to the target
getSize
public int getSize()Local delivery serializes to a single flag byte.- Overrides:
getSizein classDeliveryInstructions- Returns:
- always 1
toString