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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Decodeddecode(String base58Value, List<KeyType> keyTypes, List<Version> versions, Optional<com.google.common.primitives.UnsignedInteger> expectedLength) Decode a Base58CheckString.static Decodeddecode(String base58Value, List<Version> versions, com.google.common.primitives.UnsignedInteger expectedLength) static Decodedstatic Stringencode(UnsignedByteArray bytes, List<Version> versions, com.google.common.primitives.UnsignedInteger expectedLength) Encodes the givenUnsignedByteArrayto a Base58CheckString.static StringencodeChecked(byte[] bytes, List<Version> versions) Concatenates the givenVersionbytes 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 givenUnsignedByteArrayto a Base58CheckString.- Parameters:
bytes- AnUnsignedByteArrayof data to encode.versions- AListofVersions which should be prepended to bytes.expectedLength- The expected length of the result.- Returns:
- The Base58Check encoded
Stringof the given parameters.
-
encodeChecked
Concatenates the givenVersionbytes with the given input bytes, and Base58Check encodes the result. -
decode
- Parameters:
base58Value- The Base58Check encodedStringto be decoded.version- TheVersionto try decoding with.- Returns:
- A
Decodedcontaining the decoded value and version. - Throws:
EncodingFormatException- If the version bytes of the Base58 value are invalid.
-
decode
-
decode
public static Decoded decode(String base58Value, List<KeyType> keyTypes, List<Version> versions, Optional<com.google.common.primitives.UnsignedInteger> expectedLength) throws EncodingFormatException Decode a Base58CheckString.- Parameters:
base58Value- The Base58Check encodedStringto be decoded.keyTypes- AListofKeyTypes which can be associated with the result of this method.versions- AListofVersions to try decoding with.expectedLength- The expected length of the decoded value.- Returns:
- A
Decodedcontaining 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.
-