Package org.stellar.sdk.xdr
Class XdrUnsignedInteger
java.lang.Object
org.stellar.sdk.xdr.XdrUnsignedInteger
- All Implemented Interfaces:
XdrElement
Represents XDR Unsigned Integer.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longLargest value representable by XDR unsigned integer.static final longSmallest value representable by XDR unsigned integer.Fields inherited from interface org.stellar.sdk.xdr.XdrElement
gson -
Constructor Summary
ConstructorsConstructorDescriptionXdrUnsignedInteger(Integer number) Creates anXdrUnsignedIntegerfrom a non-negativeInteger.XdrUnsignedInteger(Long number) Creates anXdrUnsignedIntegerfrom aLong. -
Method Summary
Modifier and TypeMethodDescriptionstatic XdrUnsignedIntegerdecode(XdrDataInputStream stream) Decodes anXdrUnsignedIntegerfrom the provided stream using the default maximum depth.static XdrUnsignedIntegerdecode(XdrDataInputStream stream, int maxDepth) Decodes anXdrUnsignedIntegerfrom the provided stream.voidencode(XdrDataOutputStream stream) Encodes this value to XDR.booleanstatic XdrUnsignedIntegerParses anXdrUnsignedIntegerfrom JSON.static XdrUnsignedIntegerfromXdrBase64(String xdr) Decodes anXdrUnsignedIntegerfrom a base64-encoded XDR string.static XdrUnsignedIntegerfromXdrByteArray(byte[] xdr) Decodes anXdrUnsignedIntegerfrom raw XDR bytes.Numeric value stored by this XDR unsigned integer.inthashCode()toJson()Serializes this value to JSON.toString()Methods inherited from interface org.stellar.sdk.xdr.XdrElement
toXdrBase64, toXdrByteArray
-
Field Details
-
MAX_VALUE
public static final long MAX_VALUELargest value representable by XDR unsigned integer.- See Also:
-
MIN_VALUE
public static final long MIN_VALUESmallest value representable by XDR unsigned integer.- See Also:
-
-
Constructor Details
-
XdrUnsignedInteger
Creates anXdrUnsignedIntegerfrom aLong.- Parameters:
number- the unsigned 32-bit value- Throws:
IllegalArgumentException- ifnumberis outside the valid range
-
XdrUnsignedInteger
Creates anXdrUnsignedIntegerfrom a non-negativeInteger.- Parameters:
number- the unsigned 32-bit value- Throws:
IllegalArgumentException- ifnumberis negative
-
-
Method Details
-
decode
Decodes anXdrUnsignedIntegerfrom the provided stream.- Parameters:
stream- the source XDR input streammaxDepth- the maximum decoding depth, ignored for this leaf type- Returns:
- the decoded
XdrUnsignedInteger - Throws:
IOException- if an I/O error occurs while reading the value
-
decode
Decodes anXdrUnsignedIntegerfrom the provided stream using the default maximum depth.- Parameters:
stream- the source XDR input stream- Returns:
- the decoded
XdrUnsignedInteger - Throws:
IOException- if an I/O error occurs while reading the value
-
encode
Encodes this value to XDR.- Specified by:
encodein interfaceXdrElement- Parameters:
stream- the destination XDR output stream- Throws:
IOException- if an I/O error occurs while writing the value
-
toJson
Serializes this value to JSON.- Specified by:
toJsonin interfaceXdrElement- Returns:
- the JSON representation of this value
-
fromJson
Parses anXdrUnsignedIntegerfrom JSON.- Parameters:
json- the JSON representation- Returns:
- the parsed
XdrUnsignedInteger, ornullif the input isnull - Throws:
IllegalArgumentException- if the JSON value is invalid
-
fromXdrBase64
Decodes anXdrUnsignedIntegerfrom a base64-encoded XDR string.- Parameters:
xdr- the base64-encoded XDR string- Returns:
- the decoded
XdrUnsignedInteger - Throws:
IOException- if the input is invalid or cannot be decoded
-
fromXdrByteArray
Decodes anXdrUnsignedIntegerfrom raw XDR bytes.- Parameters:
xdr- the raw XDR bytes- Returns:
- the decoded
XdrUnsignedInteger - Throws:
IOException- if the input is invalid or cannot be decoded
-
getNumber
Numeric value stored by this XDR unsigned integer.- Returns:
- the unsigned 32-bit value as a
Long
-
equals
-
hashCode
public int hashCode() -
toString
-