Class Address

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

Serializer


public final class Address extends ByteArray
Address

Represents a NEM address; toString() returns the base32-encoded form.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Length of encoded address string.
    static final int
    Byte size of raw address.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a default-initialized (all-zero bytes) NEM address.
    Address(byte[] bytes)
    Creates a NEM address from raw bytes.
    Address(String addressString)
    Creates a NEM address from a base32 string.
    Copy constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Address
    deserialize(byte[] payload)
    Deserializes a NEM address from a payload, consuming exactly SIZE bytes.
    static Address
    deserialize(byte[] payload, int offset)
    Deserializes a NEM address from a payload, consuming exactly SIZE bytes starting at offset.
    static Address
    parse(Object rawValue)
    Parses a raw value (Address, base32 string, byte array, or SDK ByteArray) into a Address.
    Returns the external string representation — hex by default.

    Methods inherited from class org.symbol.sdk.ByteArray

    bytes, equals, hashCode, serialize, size, toBytes, toJson

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 encoded address string.
      See Also:
  • Constructor Details

    • Address

      public Address()
      Creates a default-initialized (all-zero bytes) NEM address.
    • Address

      public Address(byte[] bytes)
      Creates a NEM address from raw bytes.
      Parameters:

      bytes - Raw address bytes.

    • Address

      public Address(String addressString)
      Creates a NEM 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 NEM address from a payload, consuming exactly SIZE bytes.

      Parameters:

      payload - Buffer to read from; only the first SIZE bytes are consumed.

      Returns:

      Deserialized address.

    • deserialize

      public static Address deserialize(byte[] payload, int offset)
      Address.deserialize

      Deserializes a NEM address from a payload, consuming exactly SIZE bytes starting at offset.

      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.

    • 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.