Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / Pong.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A pong message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class Pong extends CommonBase {
16         Pong(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.Pong_free(ptr); }
21         }
22
23         /**
24          * The pong packet size.
25          * This field is not sent on the wire. byteslen zeros are sent.
26          */
27         public short get_byteslen() {
28                 short ret = bindings.Pong_get_byteslen(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * The pong packet size.
35          * This field is not sent on the wire. byteslen zeros are sent.
36          */
37         public void set_byteslen(short val) {
38                 bindings.Pong_set_byteslen(this.ptr, val);
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * Constructs a new Pong given each field
45          */
46         public static Pong of(short byteslen_arg) {
47                 long ret = bindings.Pong_new(byteslen_arg);
48                 Reference.reachabilityFence(byteslen_arg);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Pong(null, ret); }
51                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
52                 return ret_hu_conv;
53         }
54
55         long clone_ptr() {
56                 long ret = bindings.Pong_clone_ptr(this.ptr);
57                 Reference.reachabilityFence(this);
58                 return ret;
59         }
60
61         /**
62          * Creates a copy of the Pong
63          */
64         public Pong clone() {
65                 long ret = bindings.Pong_clone(this.ptr);
66                 Reference.reachabilityFence(this);
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Pong(null, ret); }
69                 ret_hu_conv.ptrs_to.add(this);
70                 return ret_hu_conv;
71         }
72
73         /**
74          * Serialize the Pong object into a byte array which can be read by Pong_read
75          */
76         public byte[] write() {
77                 byte[] ret = bindings.Pong_write(this.ptr);
78                 Reference.reachabilityFence(this);
79                 return ret;
80         }
81
82         /**
83          * Read a Pong from a byte array, created by Pong_write
84          */
85         public static Result_PongDecodeErrorZ read(byte[] ser) {
86                 long ret = bindings.Pong_read(ser);
87                 Reference.reachabilityFence(ser);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);
90                 return ret_hu_conv;
91         }
92
93 }