Package com.tuladb
Class Codec
java.lang.Object
com.tuladb.Codec
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final classA 32-byte transfer id the Base62 (ISO 20022) id mode cannot represent: only bytes 0..25 are public there, and the engine zeroes 26..31 when it runs withuse_iso20022_ref_size = true. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intGET_BALANCE: the key; + 8 bytes with a read-your-writes token.static final intstatic final intstatic final longThe highest ledger id a client may use; [0xFFFFFFF0, 0xFFFFFFFF] is the engine's.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]buildTransferIdCanonicalInput(long sourceId, int ledgerId, int currency, String txnId) ledgerIdandcurrencyare the engine's u32s carried in a Javaint, as everywhere on this SDK's wire: a value of 2^31 or more arrives negative and is read UNSIGNED ((int) 3_000_000_000Lis ledger 3000000000).static byte[]buildTransferIdCanonicalInput(long sourceId, long ledgerId, long currency, String txnId) As above, with ledger and currency as plain (non-negative) u32 values.static Models.AccountBalancedecodeAccountBalanceRow(byte[] payload, int offset) One 64-byte WireAccountBalanceRow atoffset.static List<Models.AccountMetadataEvent> decodeAccountHistory(byte[] payload) static Models.AccountInfodecodeAccountInfo(byte[] payload) static Models.AccountMetadataEventdecodeAccountMetadataEvent(byte[] payload) static Models.BalancedecodeBalance(byte[] payload) static Models.ClusterStatusdecodeClusterStatus(byte[] payload) static Models.CurrencyInstancedecodeCurrencyInstance(byte[] payload, int offset) static List<Models.TxnRecord> decodeHistory(byte[] payload) static Models.LedgerInstancedecodeLedgerInstance(byte[] payload, int offset) static List<Models.AccountBalance> decodeListAccountBalances(byte[] payload) [u32 count][u32 pad][count x 64-byte rows], one row per currency.static Codec.ListAccountsResultdecodeListAccounts(byte[] payload) static List<Models.TxnRecord> decodeListTransfers(byte[] payload) static Models.SourceInstancedecodeSourceInstance(byte[] payload, int offset) static Models.TieredTransferResultdecodeTieredTransferResult(byte[] payload) static Models.TransferResultdecodeTransferResult(byte[] payload) static Models.TransferResultdecodeTransferResult(byte[] payload, int overrideStatus) static Models.TxnRecorddecodeTxnRecord(byte[] payload) static StringderiveTransferId(long sourceId, int ledgerId, int currency, String txnId) static StringderiveTransferId(long sourceId, int ledgerId, int currency, String txnId, boolean useIso20022RefSize) static StringderiveTransferId(long sourceId, long ledgerId, long currency, String txnId, boolean useIso20022RefSize) As above, with ledger and currency as plain u32 values.static byte[]deriveTransferIdBytes(long sourceId, int ledgerId, int currency, String txnId) static byte[]deriveTransferIdBytes(long sourceId, int ledgerId, int currency, String txnId, boolean useIso20022RefSize) static byte[]deriveTransferIdBytes(long sourceId, long ledgerId, long currency, String txnId, boolean useIso20022RefSize) As above, with ledger and currency as plain u32 values (see buildTransferIdCanonicalInput).static byte[]static byte[]static byte[]static byte[]static byte[]static byte[]static byte[]A bare WireAccountKey (32 bytes).static byte[]encodeAccountSetActive(Models.AccountKey key, boolean active) static byte[]encodeCurrencyGet(int numeric) static byte[]encodeCurrencySetActive(int numeric, boolean active) static byte[]encodeGetAccountHistory(Models.AccountKey key, long afterTimestamp, int limit) static byte[]encodeGetBalance(Models.AccountKey key, long minBatchSeq) GET_BALANCE: the key (32 B); with a non-zero read-your-writes token, the key then the u64 batch_seq the read must have applied through (40 B).static byte[]encodeGetHistory(Models.AccountKey key, long afterSeq, int limit) static byte[]encodeGetHistory(Models.AccountKey key, long afterSeq, int afterIndex, int limit) Composite pagination cursor (M1).static byte[]encodeLedgerGet(int ledgerId) static byte[]encodeLedgerSourceAllow(int ledgerId, int sourceNumeric) static byte[]encodeListAccountBalances(int ledgerId, long accountHi, long accountLo) LIST_ACCOUNT_BALANCES (0x2C): {u32 ledger_id; u32 0; u64 0; u128 id} (32 B).static byte[]encodeListAccounts(int offset, int limit) static byte[]encodeListTransfers(long afterSeq, int limit) static byte[]encodeListTransfers(long afterSeq, int afterIndex, int limit) Composite pagination cursor.static byte[]static byte[]encodeSourceGet(int numeric) static byte[]encodeSourceSetActive(int numeric, boolean active) static byte[]encodeTransferId(String transferId) static byte[]encodeTransferId(String transferId, boolean useIso20022RefSize) static StringnormalizeTxnIdForKey(String txnId) static StringtransferIdFromBytes(byte[] raw) Base62 mode; seetransferIdFromBytes(byte[], boolean).static StringtransferIdFromBytes(byte[] raw, boolean useIso20022RefSize) Format a 32-byte wire transfer id in the client's id mode: 35-char Base62 (bytes 0..25) or 64-char hex.
-
Field Details
-
TXN_ID_LEN
public static final int TXN_ID_LEN- See Also:
-
ACCOUNT_CREATE_SIZE
public static final int ACCOUNT_CREATE_SIZE- See Also:
-
ACCOUNT_KEY_SIZE
public static final int ACCOUNT_KEY_SIZE- See Also:
-
GET_BALANCE_SIZE
public static final int GET_BALANCE_SIZEGET_BALANCE: the key; + 8 bytes with a read-your-writes token.- See Also:
-
LIST_ACCOUNT_BALANCES_REQ_SIZE
public static final int LIST_ACCOUNT_BALANCES_REQ_SIZE- See Also:
-
ACCOUNT_BALANCE_ROW_SIZE
public static final int ACCOUNT_BALANCE_ROW_SIZE- See Also:
-
ACCOUNT_UPDATE_SIZE
public static final int ACCOUNT_UPDATE_SIZE- See Also:
-
TRANSFER_CREATE_SIZE
public static final int TRANSFER_CREATE_SIZE- See Also:
-
TRANSFER_RESULT_SIZE
public static final int TRANSFER_RESULT_SIZE- See Also:
-
BALANCE_SIZE
public static final int BALANCE_SIZE- See Also:
-
GET_HISTORY_SIZE
public static final int GET_HISTORY_SIZE- See Also:
-
GET_ACCOUNT_HISTORY_SIZE
public static final int GET_ACCOUNT_HISTORY_SIZE- See Also:
-
TXN_RECORD_SIZE
public static final int TXN_RECORD_SIZE- See Also:
-
ACCOUNT_METADATA_EVENT_SIZE
public static final int ACCOUNT_METADATA_EVENT_SIZE- See Also:
-
CLUSTER_STATUS_SIZE
public static final int CLUSTER_STATUS_SIZE- See Also:
-
LEDGER_SOURCE_ALLOW_SIZE
public static final int LEDGER_SOURCE_ALLOW_SIZE- See Also:
-
TIERED_TRANSFER_CREATE_SIZE
public static final int TIERED_TRANSFER_CREATE_SIZE- See Also:
-
TIERED_TRANSFER_RESULT_SIZE
public static final int TIERED_TRANSFER_RESULT_SIZE- See Also:
-
ACCOUNT_INFO_SIZE
public static final int ACCOUNT_INFO_SIZE- See Also:
-
LIST_ACCOUNTS_REQ_SIZE
public static final int LIST_ACCOUNTS_REQ_SIZE- See Also:
-
LIST_TRANSFERS_REQ_SIZE
public static final int LIST_TRANSFERS_REQ_SIZE- See Also:
-
SEARCH_TXNS_REQ_SIZE
public static final int SEARCH_TXNS_REQ_SIZE- See Also:
-
TRANSFER_ID_PUBLIC_BYTES
public static final int TRANSFER_ID_PUBLIC_BYTES- See Also:
-
TRANSFER_ID_BASE62_LEN
public static final int TRANSFER_ID_BASE62_LEN- See Also:
-
TRANSFER_ID_HEX_LEN
public static final int TRANSFER_ID_HEX_LEN- See Also:
-
TRANSFER_ID_LEN
public static final int TRANSFER_ID_LEN- See Also:
-
QUERY_ANY_U32
public static final int QUERY_ANY_U32- See Also:
-
QUERY_ANY_U8
public static final int QUERY_ANY_U8- See Also:
-
LEDGER_ID_CLIENT_MAX
public static final long LEDGER_ID_CLIENT_MAXThe highest ledger id a client may use; [0xFFFFFFF0, 0xFFFFFFFF] is the engine's.- See Also:
-
LEDGER_INFO_SIZE
public static final int LEDGER_INFO_SIZE- See Also:
-
LEDGER_GET_SIZE
public static final int LEDGER_GET_SIZE- See Also:
-
SOURCE_INFO_SIZE
public static final int SOURCE_INFO_SIZE- See Also:
-
SOURCE_GET_SIZE
public static final int SOURCE_GET_SIZE- See Also:
-
SOURCE_SET_ACTIVE_SIZE
public static final int SOURCE_SET_ACTIVE_SIZE- See Also:
-
ACCOUNT_SET_ACTIVE_SIZE
public static final int ACCOUNT_SET_ACTIVE_SIZE- See Also:
-
CURRENCY_INFO_SIZE
public static final int CURRENCY_INFO_SIZE- See Also:
-
CURRENCY_GET_SIZE
public static final int CURRENCY_GET_SIZE- See Also:
-
CURRENCY_SET_ACTIVE_SIZE
public static final int CURRENCY_SET_ACTIVE_SIZE- See Also:
-
-
Method Details
-
normalizeTxnIdForKey
-
buildTransferIdCanonicalInput
public static byte[] buildTransferIdCanonicalInput(long sourceId, int ledgerId, int currency, String txnId) ledgerIdandcurrencyare the engine's u32s carried in a Javaint, as everywhere on this SDK's wire: a value of 2^31 or more arrives negative and is read UNSIGNED ((int) 3_000_000_000Lis ledger 3000000000). Thelongoverloads take the plain value. Ledger ids aboveLEDGER_ID_CLIENT_MAX(0xFFFFFFEF) are the engine's reserved range and are refused, which also catches a stray-1. -
buildTransferIdCanonicalInput
public static byte[] buildTransferIdCanonicalInput(long sourceId, long ledgerId, long currency, String txnId) As above, with ledger and currency as plain (non-negative) u32 values. -
deriveTransferIdBytes
-
deriveTransferIdBytes
public static byte[] deriveTransferIdBytes(long sourceId, int ledgerId, int currency, String txnId, boolean useIso20022RefSize) -
deriveTransferIdBytes
public static byte[] deriveTransferIdBytes(long sourceId, long ledgerId, long currency, String txnId, boolean useIso20022RefSize) As above, with ledger and currency as plain u32 values (see buildTransferIdCanonicalInput). -
transferIdFromBytes
Base62 mode; seetransferIdFromBytes(byte[], boolean). -
transferIdFromBytes
Format a 32-byte wire transfer id in the client's id mode: 35-char Base62 (bytes 0..25) or 64-char hex. In Base62 mode a non-zero byte 26..31 throwsCodec.TransferIdModeExceptioninstead of being dropped. -
deriveTransferId
-
deriveTransferId
-
deriveTransferId
public static String deriveTransferId(long sourceId, long ledgerId, long currency, String txnId, boolean useIso20022RefSize) As above, with ledger and currency as plain u32 values. -
encode
-
decodeLedgerInstance
-
encodeLedgerGet
public static byte[] encodeLedgerGet(int ledgerId) -
encodeLedgerSourceAllow
public static byte[] encodeLedgerSourceAllow(int ledgerId, int sourceNumeric) -
encode
-
decodeSourceInstance
-
encodeSourceGet
public static byte[] encodeSourceGet(int numeric) -
encodeSourceSetActive
public static byte[] encodeSourceSetActive(int numeric, boolean active) -
encodeAccountKey
A bare WireAccountKey (32 bytes). -
encodeGetBalance
GET_BALANCE: the key (32 B); with a non-zero read-your-writes token, the key then the u64 batch_seq the read must have applied through (40 B). -
encodeAccountSetActive
-
encodeListAccountBalances
public static byte[] encodeListAccountBalances(int ledgerId, long accountHi, long accountLo) LIST_ACCOUNT_BALANCES (0x2C): {u32 ledger_id; u32 0; u64 0; u128 id} (32 B). -
decodeAccountBalanceRow
One 64-byte WireAccountBalanceRow atoffset. -
decodeListAccountBalances
[u32 count][u32 pad][count x 64-byte rows], one row per currency. -
encode
-
decodeCurrencyInstance
-
encodeCurrencyGet
public static byte[] encodeCurrencyGet(int numeric) -
encodeCurrencySetActive
public static byte[] encodeCurrencySetActive(int numeric, boolean active) -
encode
-
encode
-
encode
-
encodeTransferId
-
encodeTransferId
-
encodeGetHistory
-
encodeGetHistory
public static byte[] encodeGetHistory(Models.AccountKey key, long afterSeq, int afterIndex, int limit) Composite pagination cursor (M1). A batch shares one batch_seq across all of its records, so a batch larger than one page must resume mid-batch on batch_index or its overflow rows are re-emitted (or dropped); the server orders by (batch_seq, batch_index) strictly after (afterSeq, afterIndex). afterIndex 0 resumes at the batch start — the original behaviour. MirrorsencodeListTransfers(long, int, int); the WireGetHistory after_index field lives at offset 44, after the 32-byte key. -
encodeGetAccountHistory
-
encodeListAccounts
public static byte[] encodeListAccounts(int offset, int limit) -
encodeListTransfers
public static byte[] encodeListTransfers(long afterSeq, int limit) -
encodeListTransfers
public static byte[] encodeListTransfers(long afterSeq, int afterIndex, int limit) Composite pagination cursor. A batch shares one batch_seq across all of its records, so a batch larger than one page must resume mid-batch on batch_index or its overflow rows are silently dropped; the server orders by (batch_seq, batch_index) strictly after (afterSeq, afterIndex). Zero afterIndex resumes at the batch start. -
encodeSearchTransactions
-
decodeTransferResult
-
decodeTransferResult
-
decodeTieredTransferResult
-
decodeBalance
-
decodeTxnRecord
-
decodeHistory
-
decodeAccountMetadataEvent
-
decodeAccountHistory
-
decodeListTransfers
-
decodeClusterStatus
-
decodeAccountInfo
-
decodeListAccounts
-