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 * A splice_locked message to be sent to or received from a peer.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class SpliceLocked extends CommonBase {
16 SpliceLocked(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.SpliceLocked_free(ptr); }
26 public byte[] get_channel_id() {
27 byte[] ret = bindings.SpliceLocked_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
35 public void set_channel_id(byte[] val) {
36 bindings.SpliceLocked_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * Constructs a new SpliceLocked given each field
44 public static SpliceLocked of(byte[] channel_id_arg) {
45 long ret = bindings.SpliceLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32));
46 Reference.reachabilityFence(channel_id_arg);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
54 long ret = bindings.SpliceLocked_clone_ptr(this.ptr);
55 Reference.reachabilityFence(this);
60 * Creates a copy of the SpliceLocked
62 public SpliceLocked clone() {
63 long ret = bindings.SpliceLocked_clone(this.ptr);
64 Reference.reachabilityFence(this);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
72 * Checks if two SpliceLockeds contain equal inner contents.
73 * This ignores pointers and is_owned flags and looks at the values in fields.
74 * Two objects with NULL inner values will be considered "equal" here.
76 public boolean eq(org.ldk.structs.SpliceLocked b) {
77 boolean ret = bindings.SpliceLocked_eq(this.ptr, b == null ? 0 : b.ptr);
78 Reference.reachabilityFence(this);
79 Reference.reachabilityFence(b);
80 if (this != null) { this.ptrs_to.add(b); };
84 @Override public boolean equals(Object o) {
85 if (!(o instanceof SpliceLocked)) return false;
86 return this.eq((SpliceLocked)o);
89 * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read
91 public byte[] write() {
92 byte[] ret = bindings.SpliceLocked_write(this.ptr);
93 Reference.reachabilityFence(this);
98 * Read a SpliceLocked from a byte array, created by SpliceLocked_write
100 public static Result_SpliceLockedDecodeErrorZ read(byte[] ser) {
101 long ret = bindings.SpliceLocked_read(ser);
102 Reference.reachabilityFence(ser);
103 if (ret >= 0 && ret <= 4096) { return null; }
104 Result_SpliceLockedDecodeErrorZ ret_hu_conv = Result_SpliceLockedDecodeErrorZ.constr_from_ptr(ret);