Update auto-generated bindings
[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
8
9 /**
10  * An error message to be sent or received from a peer
11  */
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 {
17                 super.finalize();
18                 if (ptr != 0) { bindings.ErrorMessage_free(ptr); }
19         }
20
21         /**
22          * The channel ID involved in the error
23          */
24         public byte[] get_channel_id() {
25                 byte[] ret = bindings.ErrorMessage_get_channel_id(this.ptr);
26                 return ret;
27         }
28
29         /**
30          * The channel ID involved in the error
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.ErrorMessage_set_channel_id(this.ptr, val);
34         }
35
36         /**
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.
41          */
42         public String get_data() {
43                 String ret = bindings.ErrorMessage_get_data(this.ptr);
44                 return ret;
45         }
46
47         /**
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.
52          */
53         public void set_data(String val) {
54                 bindings.ErrorMessage_set_data(this.ptr, val);
55         }
56
57         /**
58          * Constructs a new ErrorMessage given each field
59          */
60         public static ErrorMessage of(byte[] channel_id_arg, String 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);
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Creates a copy of the ErrorMessage
69          */
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);
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
79          */
80         public byte[] write() {
81                 byte[] ret = bindings.ErrorMessage_write(this.ptr);
82                 return ret;
83         }
84
85         /**
86          * Read a ErrorMessage from a byte array, created by ErrorMessage_write
87          */
88         public static Result_ErrorMessageDecodeErrorZ read(byte[] ser) {
89                 long ret = bindings.ErrorMessage_read(ser);
90                 Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret);
91                 return ret_hu_conv;
92         }
93
94 }