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 * Represents a hostname for serialization purposes.
13 * Only the character set and length will be validated.
14 * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
15 * Its length is guaranteed to be representable by a single byte.
16 * This serialization is used by BOLT 7 hostnames.
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class Hostname extends CommonBase {
20 Hostname(Object _dummy, long ptr) { super(ptr); }
21 @Override @SuppressWarnings("deprecation")
22 protected void finalize() throws Throwable {
24 if (ptr != 0) { bindings.Hostname_free(ptr); }
28 long ret = bindings.Hostname_clone_ptr(this.ptr);
29 Reference.reachabilityFence(this);
34 * Creates a copy of the Hostname
36 public Hostname clone() {
37 long ret = bindings.Hostname_clone(this.ptr);
38 Reference.reachabilityFence(this);
39 if (ret >= 0 && ret <= 4096) { return null; }
40 org.ldk.structs.Hostname ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Hostname(null, ret); }
41 ret_hu_conv.ptrs_to.add(this);
46 * Returns the length of the hostname.
49 byte ret = bindings.Hostname_len(this.ptr);
50 Reference.reachabilityFence(this);