Package score
Class Address
- java.lang.Object
-
- score.Address
-
public class Address extends java.lang.ObjectRepresents an address of account in the ICON Network.
-
-
Field Summary
Fields Modifier and Type Field Description static intLENGTHThe 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 booleanequals(java.lang.Object obj)Compares this address to the specified object.static AddressfromString(java.lang.String str)Creates an address from the hex string format.inthashCode()Returns a hash code for this address.booleanisContract()Returns true if and only if this address represents a contract address.byte[]toByteArray()Converts this address to a new byte array.java.lang.StringtoString()Returns a string representation of this address.
-
-
-
Field Detail
-
LENGTH
public static final int LENGTH
The length of an address.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Address
public Address(byte[] raw) throws java.lang.IllegalArgumentExceptionCreates 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 nulljava.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 nulljava.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:
hashCodein classjava.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:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare this address against- Returns:
- true if the given object represents an
Addressequivalent to this address, false otherwise
-
toString
public java.lang.String toString()
Returns a string representation of this address.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this object
-
-