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 * An error message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ErrorMessage extends CommonBase {
15 ErrorMessage(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ErrorMessage_free(ptr); }
23 * The channel ID involved in the error
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.ErrorMessage_get_channel_id(this.ptr);
31 * The channel ID involved in the error
33 public void set_channel_id(byte[] val) {
34 bindings.ErrorMessage_set_channel_id(this.ptr, val);
38 * A possibly human-readable error description.
39 * The string should be sanitized before it is used (e.g. emitted to logs
40 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
41 * vulnerability in the terminal emulator or the logging subsystem.
43 public String get_data() {
44 String ret = bindings.ErrorMessage_get_data(this.ptr);
49 * A possibly human-readable error description.
50 * The string should be sanitized before it is used (e.g. emitted to logs
51 * or printed to stdout). Otherwise, a well crafted error message may trigger a security
52 * vulnerability in the terminal emulator or the logging subsystem.
54 public void set_data(java.lang.String val) {
55 bindings.ErrorMessage_set_data(this.ptr, val);
59 * Constructs a new ErrorMessage given each field
61 public static ErrorMessage of(byte[] channel_id_arg, java.lang.String data_arg) {
62 long ret = bindings.ErrorMessage_new(channel_id_arg, data_arg);
63 if (ret < 1024) { return null; }
64 ErrorMessage ret_hu_conv = new ErrorMessage(null, ret);
65 ret_hu_conv.ptrs_to.add(ret_hu_conv);
70 * Creates a copy of the ErrorMessage
72 public ErrorMessage clone() {
73 long ret = bindings.ErrorMessage_clone(this.ptr);
74 if (ret < 1024) { return null; }
75 ErrorMessage ret_hu_conv = new ErrorMessage(null, ret);
76 ret_hu_conv.ptrs_to.add(this);
81 * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
83 public byte[] write() {
84 byte[] ret = bindings.ErrorMessage_write(this.ptr);
89 * Read a ErrorMessage from a byte array, created by ErrorMessage_write
91 public static Result_ErrorMessageDecodeErrorZ read(byte[] ser) {
92 long ret = bindings.ErrorMessage_read(ser);
93 if (ret < 1024) { return null; }
94 Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret);