2020-05-01 15:39:29 +02:00
|
|
|
import java.io.ByteArrayOutputStream;
|
2021-01-26 23:01:52 +01:00
|
|
|
import java.io.DataOutput;
|
2020-05-01 15:39:29 +02:00
|
|
|
import java.io.DataOutputStream;
|
2020-05-02 19:39:54 +02:00
|
|
|
import java.io.InputStream;
|
2020-05-01 15:39:29 +02:00
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.lang.IllegalStateException;
|
|
|
|
import java.io.IOException;
|
2020-05-14 21:59:50 +02:00
|
|
|
import java.io.DataInput;
|
2020-10-15 11:38:01 +02:00
|
|
|
import java.util.Arrays;
|
2020-10-16 22:12:42 +02:00
|
|
|
import java.util.Objects;
|
2020-05-01 15:39:29 +02:00
|
|
|
|
2021-10-23 18:12:46 +02:00
|
|
|
public final class TdApi {
|
2021-10-23 18:06:47 +02:00
|
|
|
public abstract static class Object {
|
|
|
|
public native String toString();
|
2020-05-01 15:39:29 +02:00
|
|
|
|
2021-10-23 18:06:47 +02:00
|
|
|
public abstract int getConstructor();
|
2020-05-01 15:39:29 +02:00
|
|
|
|
2021-10-23 18:16:46 +02:00
|
|
|
private Object() {}
|
|
|
|
|
2021-10-23 18:06:47 +02:00
|
|
|
public byte[] serialize() throws IOException {
|
|
|
|
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
|
|
|
try (DataOutputStream out = new DataOutputStream(baos)) {
|
|
|
|
serialize(out);
|
|
|
|
return baos.toByteArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-01 15:39:29 +02:00
|
|
|
|
2021-10-23 18:06:47 +02:00
|
|
|
public abstract void serialize(DataOutput out) throws IOException;
|
|
|
|
}
|
2020-05-01 15:39:29 +02:00
|
|
|
|
2021-10-23 18:06:47 +02:00
|
|
|
public abstract static class Function<R extends TdApi.Object> extends TdApi.Object {
|
2021-10-23 18:16:46 +02:00
|
|
|
private Function() {}
|
|
|
|
|
2021-10-23 18:06:47 +02:00
|
|
|
public native String toString();
|
2020-05-01 15:39:29 +02:00
|
|
|
}
|
2021-10-23 18:06:47 +02:00
|
|
|
|