1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * An error message to be sent or received from a peer
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class ErrorMessage extends CommonBase {
14 ErrorMessage(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.ErrorMessage_free(ptr); }
22 * The channel ID involved in the error
24 public byte[] get_channel_id() {
25 byte[] ret = bindings.ErrorMessage_get_channel_id(this.ptr);
30 * The channel ID involved in the error
32 public void set_channel_id(byte[] val) {
33 bindings.ErrorMessage_set_channel_id(this.ptr, val);
37 * A possibly human-readable error description.
38 * The string should be sanitized before it is used (e.g. emitted to logs
39 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
40 * vulnerability in the terminal emulator or the logging subsystem.
42 public String get_data() {
43 String ret = bindings.ErrorMessage_get_data(this.ptr);
48 * A possibly human-readable error description.
49 * The string should be sanitized before it is used (e.g. emitted to logs
50 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
51 * vulnerability in the terminal emulator or the logging subsystem.
53 public void set_data(byte[] val) {
54 bindings.ErrorMessage_set_data(this.ptr, val);
58 * Constructs a new ErrorMessage given each field
60 public static ErrorMessage constructor_new(byte[] channel_id_arg, byte[] data_arg) {
61 long ret = bindings.ErrorMessage_new(channel_id_arg, data_arg);
62 ErrorMessage ret_hu_conv = new ErrorMessage(null, ret);
63 ret_hu_conv.ptrs_to.add(ret_hu_conv);
68 * Creates a copy of the ErrorMessage
70 public ErrorMessage clone() {
71 long ret = bindings.ErrorMessage_clone(this.ptr);
72 ErrorMessage ret_hu_conv = new ErrorMessage(null, ret);
73 ret_hu_conv.ptrs_to.add(this);
78 * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
80 public byte[] write() {
81 byte[] ret = bindings.ErrorMessage_write(this.ptr);
86 * Read a ErrorMessage from a byte array, created by ErrorMessage_write
88 public static Result_ErrorMessageDecodeErrorZ constructor_read(byte[] ser) {
89 long ret = bindings.ErrorMessage_read(ser);
90 Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret);