Package score

Class Address


  • public class Address
    extends java.lang.Object
    Represents an address of account in the ICON Network.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int LENGTH
      The length of an address.
    • Constructor Summary

      Constructors 
      Constructor Description
      Address​(byte[] raw)
      Creates an address with the contents of the given raw byte array.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Compares this address to the specified object.
      static Address fromString​(java.lang.String str)
      Creates an address from the hex string format.
      int hashCode()
      Returns a hash code for this address.
      boolean isContract()
      Returns true if and only if this address represents a contract address.
      byte[] toByteArray()
      Converts this address to a new byte array.
      java.lang.String toString()
      Returns a string representation of this address.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Address

        public Address​(byte[] raw)
                throws java.lang.IllegalArgumentException
        Creates an address with the contents of the given raw byte array.
        Parameters:
        raw - a byte array
        Throws:
        java.lang.NullPointerException - if the input byte array is null
        java.lang.IllegalArgumentException - if the input byte array length is invalid
    • Method Detail

      • fromString

        public static Address fromString​(java.lang.String str)
        Creates an address from the hex string format.
        Parameters:
        str - a hex string that represents an Address
        Returns:
        the resulting address
        Throws:
        java.lang.NullPointerException - if the input string is null
        java.lang.IllegalArgumentException - if the input string format or length is invalid
      • isContract

        public boolean isContract()
        Returns true if and only if this address represents a contract address.
        Returns:
        true if this address represents a contract address, false otherwise
      • toByteArray

        public byte[] toByteArray()
        Converts this address to a new byte array.
        Returns:
        a newly allocated byte array that represents this address
      • hashCode

        public int hashCode()
        Returns a hash code for this address.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this address to the specified object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare this address against
        Returns:
        true if the given object represents an Address equivalent to this address, false otherwise
      • toString

        public java.lang.String toString()
        Returns a string representation of this address.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this object