Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / ErrorMessage.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * An error message to be sent or received from a peer
12  */
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 {
18                 super.finalize();
19                 if (ptr != 0) { bindings.ErrorMessage_free(ptr); }
20         }
21
22         /**
23          * The channel ID involved in the error
24          */
25         public byte[] get_channel_id() {
26                 byte[] ret = bindings.ErrorMessage_get_channel_id(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * The channel ID involved in the error
32          */
33         public void set_channel_id(byte[] val) {
34                 bindings.ErrorMessage_set_channel_id(this.ptr, val);
35         }
36
37         /**
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.
42          */
43         public String get_data() {
44                 String ret = bindings.ErrorMessage_get_data(this.ptr);
45                 return ret;
46         }
47
48         /**
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.
53          */
54         public void set_data(java.lang.String val) {
55                 bindings.ErrorMessage_set_data(this.ptr, val);
56         }
57
58         /**
59          * Constructs a new ErrorMessage given each field
60          */
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 >= 0 && ret <= 4096) { return null; }
64                 ErrorMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ErrorMessage(null, ret); }
65                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Creates a copy of the ErrorMessage
71          */
72         public ErrorMessage clone() {
73                 long ret = bindings.ErrorMessage_clone(this.ptr);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 ErrorMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ErrorMessage(null, ret); }
76                 ret_hu_conv.ptrs_to.add(this);
77                 return ret_hu_conv;
78         }
79
80         /**
81          * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
82          */
83         public byte[] write() {
84                 byte[] ret = bindings.ErrorMessage_write(this.ptr);
85                 return ret;
86         }
87
88         /**
89          * Read a ErrorMessage from a byte array, created by ErrorMessage_write
90          */
91         public static Result_ErrorMessageDecodeErrorZ read(byte[] ser) {
92                 long ret = bindings.ErrorMessage_read(ser);
93                 if (ret >= 0 && ret <= 4096) { return null; }
94                 Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret);
95                 return ret_hu_conv;
96         }
97
98 }