1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * A pong message to be sent or received from a peer
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class Pong extends CommonBase {
14 Pong(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.Pong_free(ptr); }
22 * The pong packet size.
23 * This field is not sent on the wire. byteslen zeros are sent.
25 public short get_byteslen() {
26 short ret = bindings.Pong_get_byteslen(this.ptr);
31 * The pong packet size.
32 * This field is not sent on the wire. byteslen zeros are sent.
34 public void set_byteslen(short val) {
35 bindings.Pong_set_byteslen(this.ptr, val);
39 * Constructs a new Pong given each field
41 public static Pong of(short byteslen_arg) {
42 long ret = bindings.Pong_new(byteslen_arg);
43 if (ret < 1024) { return null; }
44 Pong ret_hu_conv = new Pong(null, ret);
45 ret_hu_conv.ptrs_to.add(ret_hu_conv);
50 * Creates a copy of the Pong
53 long ret = bindings.Pong_clone(this.ptr);
54 if (ret < 1024) { return null; }
55 Pong ret_hu_conv = new Pong(null, ret);
56 ret_hu_conv.ptrs_to.add(this);
61 * Serialize the Pong object into a byte array which can be read by Pong_read
63 public byte[] write() {
64 byte[] ret = bindings.Pong_write(this.ptr);
69 * Read a Pong from a byte array, created by Pong_write
71 public static Result_PongDecodeErrorZ read(byte[] ser) {
72 long ret = bindings.Pong_read(ser);
73 if (ret < 1024) { return null; }
74 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);