38 lines
956 B
Plaintext
38 lines
956 B
Plaintext
import java.io.ByteArrayOutputStream;
|
|
import java.io.DataOutput;
|
|
import java.io.DataOutputStream;
|
|
import java.io.InputStream;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.lang.IllegalStateException;
|
|
import java.io.IOException;
|
|
import java.io.DataInput;
|
|
import java.util.Arrays;
|
|
import java.util.Objects;
|
|
|
|
public final class TdApi {
|
|
public abstract static class Object {
|
|
public native String toString();
|
|
|
|
public abstract int getConstructor();
|
|
|
|
private Object() {}
|
|
|
|
public byte[] serialize() throws IOException {
|
|
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
|
try (DataOutputStream out = new DataOutputStream(baos)) {
|
|
serialize(out);
|
|
return baos.toByteArray();
|
|
}
|
|
}
|
|
}
|
|
|
|
public abstract void serialize(DataOutput out) throws IOException;
|
|
}
|
|
|
|
public abstract static class Function<R extends TdApi.Object> extends TdApi.Object {
|
|
private Function() {}
|
|
|
|
public native String toString();
|
|
}
|
|
|