Package org.xrpl.xrpl4j.codec.addresses
Class AddressBase58
java.lang.Object
org.xrpl.xrpl4j.codec.addresses.Base58
org.xrpl.xrpl4j.codec.addresses.AddressBase58
Extension of
Base58
to provide XRPL Address specific Base58 encoding and decoding functionality.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Decoded
decode
(String base58Value, List<Version> versions, com.google.common.primitives.UnsignedInteger expectedLength) Decode a Base58CheckString
with no specifiedVersionType
s.static Decoded
decode
(String base58Value, List<VersionType> versionTypes, List<Version> versions, Optional<com.google.common.primitives.UnsignedInteger> expectedLength) Decode a Base58CheckString
.static Decoded
Decode a Base58CheckString
with no specifiedVersionType
s or expected length.static String
encode
(UnsignedByteArray bytes, List<Version> versions, com.google.common.primitives.UnsignedInteger expectedLength) Encodes the givenUnsignedByteArray
to a Base58CheckString
.static String
encodeChecked
(byte[] bytes, List<Version> versions) Concatenates the givenVersion
bytes with the given input bytes, and Base58Check encodes the result.Methods inherited from class org.xrpl.xrpl4j.codec.addresses.Base58
decode, decodeChecked, encode, encodeChecked
-
Constructor Details
-
AddressBase58
public AddressBase58()
-
-
Method Details
-
encode
public static String encode(UnsignedByteArray bytes, List<Version> versions, com.google.common.primitives.UnsignedInteger expectedLength) Encodes the givenUnsignedByteArray
to a Base58CheckString
.- Parameters:
bytes
- AnUnsignedByteArray
of data to encode.versions
- AList
ofVersion
s which should be prepended to bytes.expectedLength
- The expected length of the result.- Returns:
- The Base58Check encoded
String
of the given parameters.
-
encodeChecked
Concatenates the givenVersion
bytes with the given input bytes, and Base58Check encodes the result. -
decode
Decode a Base58CheckString
with no specifiedVersionType
s or expected length.- Parameters:
base58Value
- The Base58Check encodedString
to be decoded.version
- TheVersion
to try decoding with.- Returns:
- A
Decoded
containing the decoded value and version. - Throws:
EncodingFormatException
- If the version bytes of the Base58 value are invalid.
-
decode
public static Decoded decode(String base58Value, List<Version> versions, com.google.common.primitives.UnsignedInteger expectedLength) Decode a Base58CheckString
with no specifiedVersionType
s. -
decode
public static Decoded decode(String base58Value, List<VersionType> versionTypes, List<Version> versions, Optional<com.google.common.primitives.UnsignedInteger> expectedLength) throws EncodingFormatException Decode a Base58CheckString
.- Parameters:
base58Value
- The Base58Check encodedString
to be decoded.versionTypes
- AList
ofVersionType
s which can be associated with the result of this method.versions
- AList
ofVersion
s to try decoding with.expectedLength
- The expected length of the decoded value.- Returns:
- A
Decoded
containing the decoded value, version, and type. - Throws:
EncodingFormatException
- If more than one version is supplied without an expectedLength value present, or if the version bytes of the Base58 value are invalid.
-