1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * An init message to be sent or received from a peer
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class Init extends CommonBase {
14 Init(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.Init_free(ptr); }
22 * The relevant features which the sender supports
24 public InitFeatures get_features() {
25 long ret = bindings.Init_get_features(this.ptr);
26 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
27 ret_hu_conv.ptrs_to.add(this);
32 * The relevant features which the sender supports
34 public void set_features(InitFeatures val) {
35 bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
36 this.ptrs_to.add(val);
40 * Constructs a new Init given each field
42 public static Init constructor_new(InitFeatures features_arg) {
43 long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1);
44 Init ret_hu_conv = new Init(null, ret);
45 ret_hu_conv.ptrs_to.add(ret_hu_conv);
46 ret_hu_conv.ptrs_to.add(features_arg);
51 * Creates a copy of the Init
54 long ret = bindings.Init_clone(this.ptr);
55 Init ret_hu_conv = new Init(null, ret);
56 ret_hu_conv.ptrs_to.add(this);
61 * Serialize the Init object into a byte array which can be read by Init_read
63 public byte[] write() {
64 byte[] ret = bindings.Init_write(this.ptr);
69 * Read a Init from a byte array, created by Init_write
71 public static Result_InitDecodeErrorZ constructor_read(byte[] ser) {
72 long ret = bindings.Init_read(ser);
73 Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret);