1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Features used within a `channel_announcement` message.
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class ChannelFeatures extends CommonBase {
14 ChannelFeatures(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.ChannelFeatures_free(ptr); }
22 * Checks if two ChannelFeaturess contain equal inner contents.
23 * This ignores pointers and is_owned flags and looks at the values in fields.
24 * Two objects with NULL inner values will be considered "equal" here.
26 public boolean eq(ChannelFeatures b) {
27 boolean ret = bindings.ChannelFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
33 * Creates a copy of the ChannelFeatures
35 public ChannelFeatures clone() {
36 long ret = bindings.ChannelFeatures_clone(this.ptr);
37 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
38 ret_hu_conv.ptrs_to.add(this);
43 * Create a blank Features with no features set
45 public static ChannelFeatures empty() {
46 long ret = bindings.ChannelFeatures_empty();
47 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
48 ret_hu_conv.ptrs_to.add(ret_hu_conv);
53 * Creates a Features with the bits set which are known by the implementation
55 public static ChannelFeatures known() {
56 long ret = bindings.ChannelFeatures_known();
57 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
58 ret_hu_conv.ptrs_to.add(ret_hu_conv);
63 * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
65 public byte[] write() {
66 byte[] ret = bindings.ChannelFeatures_write(this.ptr);
71 * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
73 public static Result_ChannelFeaturesDecodeErrorZ read(byte[] ser) {
74 long ret = bindings.ChannelFeatures_read(ser);
75 Result_ChannelFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelFeaturesDecodeErrorZ.constr_from_ptr(ret);