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