1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's
13 * variable-length integers except that it is serialized in big-endian instead of little-endian.
15 * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
16 * encoded in several different ways, which we must check for at deserialization-time. Thus, if
17 * you're looking for an example of a variable-length integer to use for your own project, move
18 * along, this is a rather poor design.
20 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
21 public class BigSize extends CommonBase {
22 BigSize(Object _dummy, long ptr) { super(ptr); }
23 @Override @SuppressWarnings("deprecation")
24 protected void finalize() throws Throwable {
26 if (ptr != 0) { bindings.BigSize_free(ptr); }
30 long ret = bindings.BigSize_get_a(this.ptr);
31 Reference.reachabilityFence(this);
35 public void set_a(long val) {
36 bindings.BigSize_set_a(this.ptr, val);
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * Constructs a new BigSize given each field
44 public static BigSize of(long a_arg) {
45 long ret = bindings.BigSize_new(a_arg);
46 Reference.reachabilityFence(a_arg);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.BigSize ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BigSize(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };