Package org.symbol.sdk.symbol
Class Address
java.lang.Object
org.symbol.sdk.ByteArray
org.symbol.sdk.symbol.Address
- All Implemented Interfaces:
Serializer
- Address
- Represents a Symbol address;
toString()yields the 39-character base32 encoding.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLength of an encoded address string.static final intByte size of raw address. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Addressdeserialize(byte[] payload) Deserializes a Symbol address from a payload; consumes exactlySIZEbytes.static Addressdeserialize(byte[] payload, int offset) Deserializes a Symbol address from a payload at the given offset; consumes exactlySIZEbytes.static AddressfromDecodedAddressHexString(String hexString) Creates an address from a decoded address hex string (typically from REST).static AddressfromNamespaceId(NamespaceId namespaceId, byte networkIdentifier) Creates an alias address that references a namespace id.booleanisAlias()Determines if this address is an alias.static AddressParses a raw value (Address, base32 string, byte array, or SDK ByteArray) into a Address.Attempts to convert this address into a namespace id.toString()Returns the external string representation — hex by default.
-
Field Details
-
SIZE
public static final int SIZEByte size of raw address.- See Also:
-
ENCODED_SIZE
public static final int ENCODED_SIZELength of an encoded address string.- See Also:
-
-
Constructor Details
-
Address
public Address()Creates a default-initialized (all-zero bytes) Symbol address. -
Address
public Address(byte[] bytes) Creates a Symbol address from raw bytes.- Parameters:
bytes- Raw address bytes.
-
Address
Creates a Symbol address from a base32 string.- Parameters:
addressString- Encoded address string.
-
Address
Copy constructor.- Parameters:
other- Other address.
-
-
Method Details
-
parse
- Address.parse
- Parses a raw value (Address, base32 string, byte array, or SDK ByteArray) into a Address.
- Parameters:
rawValue- Raw value.- Returns:
- Parsed value.
-
deserialize
- Address.deserialize
- Deserializes a Symbol address from a payload; consumes exactly
SIZEbytes.
- Parameters:
payload- Buffer to read from.- Returns:
- Deserialized address.
-
deserialize
- Address.deserialize
- Deserializes a Symbol address from a payload at the given offset; consumes exactly
SIZEbytes.
- Parameters:
payload- Buffer to read from.offset- Offset into the payload at which to start reading.- Returns:
- Deserialized address.
- Throws:
IndexOutOfBoundsException- if fewer thanSIZEbytes remain atoffset.
-
isAlias
public boolean isAlias()- Address.isAlias
- Determines if this address is an alias.
- Returns:
trueif this address is an alias (low bit of the first byte is set).
-
toNamespaceId
- Address.toNamespaceId
- Attempts to convert this address into a namespace id.
- Returns:
- Namespace id if this address is an alias,
nullotherwise.
-
toString
- Address.toString
- Description copied from class:
ByteArray
Returns the external string representation — hex by default. -
fromDecodedAddressHexString
- Address.fromDecodedAddressHexString
- Creates an address from a decoded address hex string (typically from REST).
- Parameters:
hexString- Decoded address hex string.- Returns:
- Equivalent address.
-
fromNamespaceId
- Address.fromNamespaceId
- Creates an alias address that references a namespace id.
- Parameters:
namespaceId- Namespace id.networkIdentifier- Network identifier byte.- Returns:
- Address referencing the namespace id.
-