Class Address

java.lang.Object
org.symbol.sdk.ByteArray
org.symbol.sdk.symbol.Address
All Implemented Interfaces:
Serializer

public final class Address extends ByteArray
Address
Represents a Symbol address; toString() yields the 39-character base32 encoding.
  • Field Details

    • SIZE

      public static final int SIZE
      Byte size of raw address.
      See Also:
    • ENCODED_SIZE

      public static final int ENCODED_SIZE
      Length 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

      public Address(String addressString)
      Creates a Symbol address from a base32 string.
      Parameters:
      addressString - Encoded address string.
    • Address

      public Address(Address other)
      Copy constructor.
      Parameters:
      other - Other address.
  • Method Details

    • parse

      public static Address parse(Object rawValue)
      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

      public static Address deserialize(byte[] payload)
      Address.deserialize
      Deserializes a Symbol address from a payload; consumes exactly SIZE bytes.
      Parameters:
      payload - Buffer to read from.
      Returns:
      Deserialized address.
    • deserialize

      public static Address deserialize(byte[] payload, int offset)
      Address.deserialize
      Deserializes a Symbol address from a payload at the given offset; consumes exactly SIZE bytes.
      Parameters:
      payload - Buffer to read from.
      offset - Offset into the payload at which to start reading.
      Returns:
      Deserialized address.
      Throws:
      IndexOutOfBoundsException - if fewer than SIZE bytes remain at offset.
    • isAlias

      public boolean isAlias()
      Address.isAlias
      Determines if this address is an alias.
      Returns:
      true if this address is an alias (low bit of the first byte is set).
    • toNamespaceId

      public NamespaceId toNamespaceId()
      Address.toNamespaceId
      Attempts to convert this address into a namespace id.
      Returns:
      Namespace id if this address is an alias, null otherwise.
    • toString

      public String toString()
      Address.toString
      Description copied from class: ByteArray
      Returns the external string representation — hex by default.
      Overrides:
      toString in class ByteArray
      Returns:
      String representation of this value.
    • fromDecodedAddressHexString

      public static Address fromDecodedAddressHexString(String hexString)
      Address.fromDecodedAddressHexString
      Creates an address from a decoded address hex string (typically from REST).
      Parameters:
      hexString - Decoded address hex string.
      Returns:
      Equivalent address.
    • fromNamespaceId

      public static Address fromNamespaceId(NamespaceId namespaceId, byte networkIdentifier)
      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.