public static Transaction decode(XdrDataInputStream stream) throws IOException { Transaction decodedTransaction = new Transaction(); decodedTransaction.sourceAccount = AccountID.decode(stream); decodedTransaction.fee = Uint32.decode(stream); decodedTransaction.seqNum = SequenceNumber.decode(stream); int timeBoundsPresent = stream.readInt(); if (timeBoundsPresent != 0) { decodedTransaction.timeBounds = TimeBounds.decode(stream); } decodedTransaction.memo = Memo.decode(stream); int operationssize = stream.readInt(); decodedTransaction.operations = new Operation[operationssize]; for (int i = 0; i < operationssize; i++) { decodedTransaction.operations[i] = Operation.decode(stream); } decodedTransaction.ext = TransactionExt.decode(stream); return decodedTransaction; }
public static void encode(XdrDataOutputStream stream, Transaction encodedTransaction) throws IOException { AccountID.encode(stream, encodedTransaction.sourceAccount); Uint32.encode(stream, encodedTransaction.fee); SequenceNumber.encode(stream, encodedTransaction.seqNum); if (encodedTransaction.timeBounds != null) { stream.writeInt(1); TimeBounds.encode(stream, encodedTransaction.timeBounds); } else { stream.writeInt(0); } Memo.encode(stream, encodedTransaction.memo); int operationssize = encodedTransaction.getOperations().length; stream.writeInt(operationssize); for (int i = 0; i < operationssize; i++) { Operation.encode(stream, encodedTransaction.operations[i]); } TransactionExt.encode(stream, encodedTransaction.ext); }
public static SequenceNumber decode(XdrDataInputStream stream) throws IOException { SequenceNumber decodedSequenceNumber = new SequenceNumber(); decodedSequenceNumber.SequenceNumber = Uint64.decode(stream); return decodedSequenceNumber; }