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 Pong ret_hu_conv = new Pong(null, ret);
44 ret_hu_conv.ptrs_to.add(ret_hu_conv);
49 * Creates a copy of the Pong
52 long ret = bindings.Pong_clone(this.ptr);
53 Pong ret_hu_conv = new Pong(null, ret);
54 ret_hu_conv.ptrs_to.add(this);
59 * Serialize the Pong object into a byte array which can be read by Pong_read
61 public byte[] write() {
62 byte[] ret = bindings.Pong_write(this.ptr);
67 * Read a Pong from a byte array, created by Pong_write
69 public static Result_PongDecodeErrorZ read(byte[] ser) {
70 long ret = bindings.Pong_read(ser);
71 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);