1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Generated by hobgoblin.
package org.shedlang.compiler.transient0;
// Custom area start: org.shedlang.compiler.transient0.HobgoblinTransient0Builtins imports
// Custom area end: org.shedlang.compiler.transient0.HobgoblinTransient0Builtins imports
public final class HobgoblinTransient0Builtins {
public static void encodeBool(boolean value, java.io.OutputStream outputStream, java.util.Map<org.shedlang.compiler.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException {
outputStream.write(value ? 1 : 0);
}
public static boolean decodeBool(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException {
return inputStream.read() != 0;
}
public static void encodeInt8(byte value, java.io.OutputStream outputStream, java.util.Map<org.shedlang.compiler.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException {
outputStream.write(value);
}
public static byte decodeInt8(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException {
return (byte) inputStream.read();
}
public static void encodeInt32(int value, java.io.OutputStream outputStream, java.util.Map<org.shedlang.compiler.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException {
outputStream.write(value >>> 0 & 255);
outputStream.write(value >>> 8 & 255);
outputStream.write(value >>> 16 & 255);
outputStream.write(value >>> 24 & 255);
}
public static int decodeInt32(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException {
int value = 0;
value = value | inputStream.read() << 0;
value = value | inputStream.read() << 8;
value = value | inputStream.read() << 16;
value = value | inputStream.read() << 24;
return value;
}
public static void encodeInt64(long value, java.io.OutputStream outputStream, java.util.Map<org.shedlang.compiler.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException {
outputStream.write((int) (value >>> 0 & 255));
outputStream.write((int) (value >>> 8 & 255));
outputStream.write((int) (value >>> 16 & 255));
outputStream.write((int) (value >>> 24 & 255));
outputStream.write((int) (value >>> 32 & 255));
outputStream.write((int) (value >>> 40 & 255));
outputStream.write((int) (value >>> 48 & 255));
outputStream.write((int) (value >>> 56 & 255));
}
public static long decodeInt64(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException {
long value = 0;
value = value | inputStream.read() << 0;
value = value | inputStream.read() << 8;
value = value | inputStream.read() << 16;
value = value | inputStream.read() << 24;
value = value | inputStream.read() << 32;
value = value | inputStream.read() << 40;
value = value | inputStream.read() << 48;
value = value | inputStream.read() << 56;
return value;
}
public static void encodeString(String value, java.io.OutputStream outputStream, java.util.Map<org.shedlang.compiler.transient0.HobgoblinTransient0TaggedSharedValue, java.lang.Long> sharedValues) throws java.io.IOException {
var bytes = value.getBytes(java.nio.charset.StandardCharsets.UTF_8);
org.shedlang.compiler.transient0.HobgoblinTransient0Builtins.encodeInt64((long) bytes.length, outputStream, sharedValues);
outputStream.write(bytes);
}
public static String decodeString(java.io.InputStream inputStream, java.util.List<java.lang.Object> sharedValues) throws java.io.IOException {
var bytesLength = org.shedlang.compiler.transient0.HobgoblinTransient0Builtins.decodeInt64(inputStream, sharedValues);
var bytes = inputStream.readNBytes((int) bytesLength);
return new String(bytes, java.nio.charset.StandardCharsets.UTF_8);
}
// Custom area start: org.shedlang.compiler.transient0.HobgoblinTransient0Builtins body
// Custom area end: org.shedlang.compiler.transient0.HobgoblinTransient0Builtins body
}
|