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 * A pong message to be sent or received from a peer
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 {
19 if (ptr != 0) { bindings.Pong_free(ptr); }
23 * The pong packet size.
24 * This field is not sent on the wire. byteslen zeros are sent.
26 public short get_byteslen() {
27 short ret = bindings.Pong_get_byteslen(this.ptr);
32 * The pong packet size.
33 * This field is not sent on the wire. byteslen zeros are sent.
35 public void set_byteslen(short val) {
36 bindings.Pong_set_byteslen(this.ptr, val);
40 * Constructs a new Pong given each field
42 public static Pong of(short byteslen_arg) {
43 long ret = bindings.Pong_new(byteslen_arg);
44 if (ret < 1024) { return null; }
45 Pong ret_hu_conv = new Pong(null, ret);
46 ret_hu_conv.ptrs_to.add(ret_hu_conv);
51 * Creates a copy of the Pong
54 long ret = bindings.Pong_clone(this.ptr);
55 if (ret < 1024) { return null; }
56 Pong ret_hu_conv = new Pong(null, ret);
57 ret_hu_conv.ptrs_to.add(this);
62 * Serialize the Pong object into a byte array which can be read by Pong_read
64 public byte[] write() {
65 byte[] ret = bindings.Pong_write(this.ptr);
70 * Read a Pong from a byte array, created by Pong_write
72 public static Result_PongDecodeErrorZ read(byte[] ser) {
73 long ret = bindings.Pong_read(ser);
74 if (ret < 1024) { return null; }
75 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);