1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * Features used within a `channel_announcement` message.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelFeatures extends CommonBase {
15 ChannelFeatures(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ChannelFeatures_free(ptr); }
23 * Checks if two ChannelFeaturess contain equal inner contents.
24 * This ignores pointers and is_owned flags and looks at the values in fields.
25 * Two objects with NULL inner values will be considered "equal" here.
27 public boolean eq(ChannelFeatures b) {
28 boolean ret = bindings.ChannelFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
34 * Creates a copy of the ChannelFeatures
36 public ChannelFeatures clone() {
37 long ret = bindings.ChannelFeatures_clone(this.ptr);
38 if (ret < 1024) { return null; }
39 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
40 ret_hu_conv.ptrs_to.add(this);
45 * Create a blank Features with no features set
47 public static ChannelFeatures empty() {
48 long ret = bindings.ChannelFeatures_empty();
49 if (ret < 1024) { return null; }
50 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
51 ret_hu_conv.ptrs_to.add(ret_hu_conv);
56 * Creates a Features with the bits set which are known by the implementation
58 public static ChannelFeatures known() {
59 long ret = bindings.ChannelFeatures_known();
60 if (ret < 1024) { return null; }
61 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
62 ret_hu_conv.ptrs_to.add(ret_hu_conv);
67 * Returns true if this `Features` object contains unknown feature flags which are set as
70 public boolean requires_unknown_bits() {
71 boolean ret = bindings.ChannelFeatures_requires_unknown_bits(this.ptr);
76 * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
78 public byte[] write() {
79 byte[] ret = bindings.ChannelFeatures_write(this.ptr);
84 * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
86 public static Result_ChannelFeaturesDecodeErrorZ read(byte[] ser) {
87 long ret = bindings.ChannelFeatures_read(ser);
88 if (ret < 1024) { return null; }
89 Result_ChannelFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelFeaturesDecodeErrorZ.constr_from_ptr(ret);