@gglib/utils 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/Readme.md +1 -1
- package/dist/bundles/utils.esm.js +1904 -0
- package/dist/bundles/utils.esm.js.map +1 -0
- package/dist/stats.html +1248 -637
- package/dist/utils/src/collections/IdMap.d.ts +13 -0
- package/dist/utils/src/collections/IdMap.d.ts.map +1 -0
- package/dist/utils/src/collections/IdMap.js +63 -0
- package/dist/utils/src/collections/IdMap.js.map +1 -0
- package/dist/utils/src/collections/IdSet.d.ts +11 -0
- package/dist/utils/src/collections/IdSet.d.ts.map +1 -0
- package/dist/utils/src/collections/IdSet.js +47 -0
- package/dist/utils/src/collections/IdSet.js.map +1 -0
- package/dist/utils/src/collections/PooledList.d.ts +15 -0
- package/dist/utils/src/collections/PooledList.d.ts.map +1 -0
- package/dist/utils/src/collections/PooledList.js +44 -0
- package/dist/utils/src/collections/PooledList.js.map +1 -0
- package/dist/utils/src/collections/PriorityQueue.d.ts +27 -0
- package/dist/utils/src/collections/PriorityQueue.d.ts.map +1 -0
- package/dist/utils/src/collections/PriorityQueue.js +142 -0
- package/dist/utils/src/collections/PriorityQueue.js.map +1 -0
- package/dist/utils/src/collections/array.d.ts +27 -0
- package/dist/utils/src/collections/array.d.ts.map +1 -0
- package/dist/utils/src/collections/array.js +55 -0
- package/dist/utils/src/collections/array.js.map +1 -0
- package/dist/utils/src/collections/index.d.ts +6 -0
- package/dist/utils/src/collections/index.d.ts.map +1 -0
- package/dist/utils/src/collections/index.js +6 -0
- package/dist/utils/src/collections/index.js.map +1 -0
- package/dist/utils/src/events/bus.d.ts +15 -0
- package/dist/utils/src/events/bus.d.ts.map +1 -0
- package/dist/utils/src/events/bus.js +47 -0
- package/dist/utils/src/events/bus.js.map +1 -0
- package/dist/utils/src/events/channel.d.ts +23 -0
- package/dist/utils/src/events/channel.d.ts.map +1 -0
- package/dist/utils/src/events/channel.js +95 -0
- package/dist/utils/src/events/channel.js.map +1 -0
- package/dist/utils/src/events/emitter.d.ts +14 -0
- package/dist/utils/src/events/emitter.d.ts.map +1 -0
- package/dist/utils/src/events/emitter.js +37 -0
- package/dist/utils/src/events/emitter.js.map +1 -0
- package/dist/utils/src/events/index.d.ts +6 -0
- package/dist/utils/src/events/index.d.ts.map +1 -0
- package/dist/utils/src/events/index.js +6 -0
- package/dist/utils/src/events/index.js.map +1 -0
- package/dist/utils/src/events/source.d.ts +20 -0
- package/dist/utils/src/events/source.d.ts.map +1 -0
- package/dist/utils/src/events/source.js +69 -0
- package/dist/utils/src/events/source.js.map +1 -0
- package/dist/utils/src/events/types.d.ts +3 -0
- package/dist/utils/src/events/types.d.ts.map +1 -0
- package/dist/utils/src/events/types.js +2 -0
- package/dist/utils/src/events/types.js.map +1 -0
- package/dist/utils/src/index.d.ts +5 -9
- package/dist/utils/src/index.d.ts.map +1 -1
- package/dist/utils/src/index.js +5 -9
- package/dist/utils/src/index.js.map +1 -1
- package/dist/utils/src/{BinaryReader.d.ts → reader/BinaryReader.d.ts} +19 -1
- package/dist/utils/src/reader/BinaryReader.d.ts.map +1 -0
- package/dist/utils/src/{BinaryReader.js → reader/BinaryReader.js} +80 -61
- package/dist/utils/src/reader/BinaryReader.js.map +1 -0
- package/dist/utils/src/reader/TextReader.d.ts +245 -0
- package/dist/utils/src/reader/TextReader.d.ts.map +1 -0
- package/dist/utils/src/reader/TextReader.js +465 -0
- package/dist/utils/src/reader/TextReader.js.map +1 -0
- package/dist/utils/src/reader/index.d.ts +3 -0
- package/dist/utils/src/reader/index.d.ts.map +1 -0
- package/dist/utils/src/reader/index.js +3 -0
- package/dist/utils/src/reader/index.js.map +1 -0
- package/dist/utils/src/types/brand.d.ts +26 -0
- package/dist/utils/src/types/brand.d.ts.map +1 -0
- package/dist/utils/src/types/brand.js +4 -0
- package/dist/utils/src/types/brand.js.map +1 -0
- package/dist/utils/src/types/index.d.ts +4 -0
- package/dist/utils/src/types/index.d.ts.map +1 -0
- package/dist/utils/src/types/index.js +4 -0
- package/dist/utils/src/types/index.js.map +1 -0
- package/dist/utils/src/types/json-rpc.d.ts +72 -0
- package/dist/utils/src/types/json-rpc.d.ts.map +1 -0
- package/dist/utils/src/types/json-rpc.js +99 -0
- package/dist/utils/src/types/json-rpc.js.map +1 -0
- package/dist/utils/src/types/rxjs.d.ts +17 -0
- package/dist/utils/src/types/rxjs.d.ts.map +1 -0
- package/dist/utils/src/types/rxjs.js +10 -0
- package/dist/utils/src/types/rxjs.js.map +1 -0
- package/dist/utils/src/uri/index.d.ts +4 -0
- package/dist/utils/src/uri/index.d.ts.map +1 -0
- package/dist/utils/src/uri/index.js +4 -0
- package/dist/utils/src/uri/index.js.map +1 -0
- package/dist/utils/src/uri/merge.d.ts +2 -0
- package/dist/utils/src/uri/merge.d.ts.map +1 -0
- package/dist/utils/src/uri/merge.js +56 -0
- package/dist/utils/src/uri/merge.js.map +1 -0
- package/dist/utils/src/uri/parse.d.ts +129 -0
- package/dist/utils/src/uri/parse.d.ts.map +1 -0
- package/dist/utils/src/uri/parse.js +83 -0
- package/dist/utils/src/uri/parse.js.map +1 -0
- package/dist/utils/src/uri/path.d.ts +22 -0
- package/dist/utils/src/uri/path.d.ts.map +1 -0
- package/dist/utils/src/uri/path.js +34 -0
- package/dist/utils/src/uri/path.js.map +1 -0
- package/dist/utils/src/utils/dom.d.ts +7 -2
- package/dist/utils/src/utils/dom.d.ts.map +1 -1
- package/dist/utils/src/utils/dom.js +59 -63
- package/dist/utils/src/utils/dom.js.map +1 -1
- package/dist/utils/src/utils/index.d.ts +3 -8
- package/dist/utils/src/utils/index.d.ts.map +1 -1
- package/dist/utils/src/utils/index.js +3 -8
- package/dist/utils/src/utils/index.js.map +1 -1
- package/dist/utils/src/utils/logfmt.d.ts +53 -0
- package/dist/utils/src/utils/logfmt.d.ts.map +1 -0
- package/dist/utils/src/utils/logfmt.js +66 -0
- package/dist/utils/src/utils/logfmt.js.map +1 -0
- package/dist/utils/src/utils/loop.d.ts +12 -28
- package/dist/utils/src/utils/loop.d.ts.map +1 -1
- package/dist/utils/src/utils/loop.js +23 -54
- package/dist/utils/src/utils/loop.js.map +1 -1
- package/dist/utils/src/utils/metric.d.ts +23 -0
- package/dist/utils/src/utils/metric.d.ts.map +1 -0
- package/dist/utils/src/utils/metric.js +47 -0
- package/dist/utils/src/utils/metric.js.map +1 -0
- package/dist/utils/src/utils/uuid.js +3 -3
- package/dist/utils/src/utils/uuid.js.map +1 -1
- package/dist/utils/src/utils/worker.d.ts +18 -0
- package/dist/utils/src/utils/worker.d.ts.map +1 -0
- package/dist/utils/src/utils/worker.js +23 -0
- package/dist/utils/src/utils/worker.js.map +1 -0
- package/dist/utils/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +11 -4
- package/dist/bundles/utils.umd.js +0 -1666
- package/dist/bundles/utils.umd.js.map +0 -1
- package/dist/utils/src/BinaryReader.d.ts.map +0 -1
- package/dist/utils/src/BinaryReader.js.map +0 -1
- package/dist/utils/src/BinaryReader.spec.d.ts +0 -2
- package/dist/utils/src/BinaryReader.spec.d.ts.map +0 -1
- package/dist/utils/src/BinaryReader.spec.js +0 -38
- package/dist/utils/src/BinaryReader.spec.js.map +0 -1
- package/dist/utils/src/DataUri.d.ts +0 -36
- package/dist/utils/src/DataUri.d.ts.map +0 -1
- package/dist/utils/src/DataUri.js +0 -45
- package/dist/utils/src/DataUri.js.map +0 -1
- package/dist/utils/src/DataUri.spec.d.ts +0 -2
- package/dist/utils/src/DataUri.spec.d.ts.map +0 -1
- package/dist/utils/src/DataUri.spec.js +0 -34
- package/dist/utils/src/DataUri.spec.js.map +0 -1
- package/dist/utils/src/Events.d.ts +0 -59
- package/dist/utils/src/Events.d.ts.map +0 -1
- package/dist/utils/src/Events.js +0 -125
- package/dist/utils/src/Events.js.map +0 -1
- package/dist/utils/src/Events.spec.d.ts +0 -2
- package/dist/utils/src/Events.spec.d.ts.map +0 -1
- package/dist/utils/src/Events.spec.js +0 -61
- package/dist/utils/src/Events.spec.js.map +0 -1
- package/dist/utils/src/Http.d.ts +0 -56
- package/dist/utils/src/Http.d.ts.map +0 -1
- package/dist/utils/src/Http.js +0 -60
- package/dist/utils/src/Http.js.map +0 -1
- package/dist/utils/src/Http.spec.d.ts +0 -2
- package/dist/utils/src/Http.spec.d.ts.map +0 -1
- package/dist/utils/src/Http.spec.js +0 -23
- package/dist/utils/src/Http.spec.js.map +0 -1
- package/dist/utils/src/Immutable.d.ts +0 -10
- package/dist/utils/src/Immutable.d.ts.map +0 -1
- package/dist/utils/src/Immutable.js +0 -2
- package/dist/utils/src/Immutable.js.map +0 -1
- package/dist/utils/src/JsonRpc.d.ts +0 -35
- package/dist/utils/src/JsonRpc.d.ts.map +0 -1
- package/dist/utils/src/JsonRpc.js +0 -2
- package/dist/utils/src/JsonRpc.js.map +0 -1
- package/dist/utils/src/Log.d.ts +0 -26
- package/dist/utils/src/Log.d.ts.map +0 -1
- package/dist/utils/src/Log.js +0 -77
- package/dist/utils/src/Log.js.map +0 -1
- package/dist/utils/src/TextReader.d.ts +0 -100
- package/dist/utils/src/TextReader.d.ts.map +0 -1
- package/dist/utils/src/TextReader.js +0 -217
- package/dist/utils/src/TextReader.js.map +0 -1
- package/dist/utils/src/TextReader.spec.d.ts +0 -2
- package/dist/utils/src/TextReader.spec.d.ts.map +0 -1
- package/dist/utils/src/TextReader.spec.js +0 -42
- package/dist/utils/src/TextReader.spec.js.map +0 -1
- package/dist/utils/src/Uri.d.ts +0 -29
- package/dist/utils/src/Uri.d.ts.map +0 -1
- package/dist/utils/src/Uri.js +0 -129
- package/dist/utils/src/Uri.js.map +0 -1
- package/dist/utils/src/Uri.spec.d.ts +0 -2
- package/dist/utils/src/Uri.spec.d.ts.map +0 -1
- package/dist/utils/src/Uri.spec.js +0 -43
- package/dist/utils/src/Uri.spec.js.map +0 -1
- package/dist/utils/src/WebWorker.d.ts +0 -105
- package/dist/utils/src/WebWorker.d.ts.map +0 -1
- package/dist/utils/src/WebWorker.js +0 -216
- package/dist/utils/src/WebWorker.js.map +0 -1
- package/dist/utils/src/WebWorker.spec.d.ts +0 -2
- package/dist/utils/src/WebWorker.spec.d.ts.map +0 -1
- package/dist/utils/src/WebWorker.spec.js +0 -30
- package/dist/utils/src/WebWorker.spec.js.map +0 -1
- package/dist/utils/src/utils/array.d.ts +0 -39
- package/dist/utils/src/utils/array.d.ts.map +0 -1
- package/dist/utils/src/utils/array.js +0 -63
- package/dist/utils/src/utils/array.js.map +0 -1
- package/dist/utils/src/utils/get-canvas.d.ts +0 -7
- package/dist/utils/src/utils/get-canvas.d.ts.map +0 -1
- package/dist/utils/src/utils/get-canvas.js +0 -22
- package/dist/utils/src/utils/get-canvas.js.map +0 -1
- package/dist/utils/src/utils/get-option.d.ts +0 -11
- package/dist/utils/src/utils/get-option.d.ts.map +0 -1
- package/dist/utils/src/utils/get-option.js +0 -16
- package/dist/utils/src/utils/get-option.js.map +0 -1
- package/dist/utils/src/utils/getImageData.d.ts +0 -7
- package/dist/utils/src/utils/getImageData.d.ts.map +0 -1
- package/dist/utils/src/utils/getImageData.js +0 -25
- package/dist/utils/src/utils/getImageData.js.map +0 -1
- package/dist/utils/src/utils/getImageData.spec.d.ts +0 -2
- package/dist/utils/src/utils/getImageData.spec.d.ts.map +0 -1
- package/dist/utils/src/utils/getImageData.spec.js +0 -22
- package/dist/utils/src/utils/getImageData.spec.js.map +0 -1
- package/dist/utils/src/utils/hasOwnProperty.d.ts +0 -5
- package/dist/utils/src/utils/hasOwnProperty.d.ts.map +0 -1
- package/dist/utils/src/utils/hasOwnProperty.js +0 -7
- package/dist/utils/src/utils/hasOwnProperty.js.map +0 -1
- package/dist/utils/src/utils/loop.spec.d.ts +0 -2
- package/dist/utils/src/utils/loop.spec.d.ts.map +0 -1
- package/dist/utils/src/utils/loop.spec.js +0 -17
- package/dist/utils/src/utils/loop.spec.js.map +0 -1
- package/dist/utils/src/utils/object.d.ts +0 -23
- package/dist/utils/src/utils/object.d.ts.map +0 -1
- package/dist/utils/src/utils/object.js +0 -90
- package/dist/utils/src/utils/object.js.map +0 -1
- package/dist/utils/src/utils/string.d.ts +0 -19
- package/dist/utils/src/utils/string.d.ts.map +0 -1
- package/dist/utils/src/utils/string.js +0 -25
- package/dist/utils/src/utils/string.js.map +0 -1
- package/dist/utils/src/utils/type.d.ts +0 -58
- package/dist/utils/src/utils/type.d.ts.map +0 -1
- package/dist/utils/src/utils/type.js +0 -17
- package/dist/utils/src/utils/type.js.map +0 -1
- package/dist/utils/tsconfig.tsbuildinfo +0 -510
|
@@ -3,13 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export class BinaryReader {
|
|
7
|
+
/**
|
|
8
|
+
* The number of bytes remaining to read
|
|
9
|
+
*/
|
|
10
|
+
get remaining() {
|
|
11
|
+
return this.data.byteLength - this.position;
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* Creates a new instance of {@link BinaryReader}
|
|
9
15
|
*
|
|
10
16
|
* @param data - The data to read
|
|
11
17
|
*/
|
|
12
|
-
|
|
18
|
+
constructor(data) {
|
|
13
19
|
/**
|
|
14
20
|
* Byte order to read. Default is `true`
|
|
15
21
|
*/
|
|
@@ -18,157 +24,170 @@ var BinaryReader = /** @class */ (function () {
|
|
|
18
24
|
this.view = new DataView(this.data);
|
|
19
25
|
this.position = 0;
|
|
20
26
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether the readers position has not reached the end of the buffer
|
|
29
|
+
*/
|
|
30
|
+
get canRead() {
|
|
31
|
+
return this.position < this.data.byteLength;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads a single character from the current position without advancing the position.
|
|
35
|
+
*/
|
|
36
|
+
get char() {
|
|
37
|
+
return String.fromCharCode(this.byte);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reads a single byte from the current position without advancing the position.
|
|
41
|
+
*/
|
|
42
|
+
get byte() {
|
|
43
|
+
return this.data[this.position];
|
|
44
|
+
}
|
|
31
45
|
/**
|
|
32
46
|
* Reads a specified number of bytes
|
|
33
47
|
*
|
|
34
48
|
* @param length - The number of bytes to read
|
|
35
49
|
* @param output - The destination array to read into
|
|
36
50
|
*/
|
|
37
|
-
|
|
38
|
-
if (output === void 0) { output = []; }
|
|
51
|
+
readBytes(length, output = []) {
|
|
39
52
|
while (length > 0) {
|
|
40
53
|
output.push(this.view.getUint8(this.position++));
|
|
41
54
|
length--;
|
|
42
55
|
}
|
|
43
56
|
return output;
|
|
44
|
-
}
|
|
57
|
+
}
|
|
45
58
|
/**
|
|
46
59
|
* Reads a specified number of bytes as a byte array
|
|
47
60
|
*
|
|
48
61
|
* @param length - The number of bytes to read
|
|
49
62
|
*/
|
|
50
|
-
|
|
63
|
+
readByteArray(length) {
|
|
51
64
|
return new Int8Array(this.slice(length));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Reads a specified number of bytes as a byte array
|
|
68
|
+
*
|
|
69
|
+
* @param length - The number of bytes to read
|
|
70
|
+
*/
|
|
71
|
+
readUByteArray(length) {
|
|
72
|
+
return new Uint8Array(this.slice(length));
|
|
73
|
+
}
|
|
74
|
+
readBuffer(buffer, index, length) {
|
|
75
|
+
let end = index + length;
|
|
55
76
|
while (index < end) {
|
|
56
77
|
buffer[index++] = this.view.getUint8(this.position++);
|
|
57
78
|
}
|
|
58
|
-
}
|
|
79
|
+
}
|
|
59
80
|
/**
|
|
60
81
|
* Reads a single unsigned byte value
|
|
61
82
|
*/
|
|
62
|
-
|
|
83
|
+
readUByte() {
|
|
63
84
|
return this.view.getUint8(this.position++);
|
|
64
|
-
}
|
|
85
|
+
}
|
|
65
86
|
/**
|
|
66
87
|
* Reads a single signed byte value
|
|
67
88
|
*/
|
|
68
|
-
|
|
89
|
+
readByte() {
|
|
69
90
|
return this.view.getInt8(this.position++);
|
|
70
|
-
}
|
|
91
|
+
}
|
|
71
92
|
/**
|
|
72
93
|
* Reads a single unsigned short value
|
|
73
94
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
readUShort() {
|
|
96
|
+
let result = this.view.getUint16(this.position, this.littleEndian);
|
|
76
97
|
this.position += 2;
|
|
77
98
|
return result;
|
|
78
|
-
}
|
|
99
|
+
}
|
|
79
100
|
/**
|
|
80
101
|
* Reads a single signed short value
|
|
81
102
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
readShort() {
|
|
104
|
+
let result = this.view.getInt16(this.position, this.littleEndian);
|
|
84
105
|
this.position += 2;
|
|
85
106
|
return result;
|
|
86
|
-
}
|
|
107
|
+
}
|
|
87
108
|
/**
|
|
88
109
|
* Reads a single uint32 value
|
|
89
110
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
111
|
+
readUInt() {
|
|
112
|
+
let result = this.view.getUint32(this.position, this.littleEndian);
|
|
92
113
|
this.position += 4;
|
|
93
114
|
return result;
|
|
94
|
-
}
|
|
115
|
+
}
|
|
95
116
|
/**
|
|
96
117
|
* Reads a single int32 value
|
|
97
118
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
readInt() {
|
|
120
|
+
let result = this.view.getInt32(this.position, this.littleEndian);
|
|
100
121
|
this.position += 4;
|
|
101
122
|
return result;
|
|
102
|
-
}
|
|
123
|
+
}
|
|
103
124
|
/**
|
|
104
125
|
* Reads a two uint32 values as low and high bits.
|
|
105
126
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
127
|
+
readLong() {
|
|
128
|
+
let lo = this.readUInt();
|
|
129
|
+
let hi = this.readUInt() << 32;
|
|
109
130
|
return hi + lo;
|
|
110
|
-
}
|
|
131
|
+
}
|
|
111
132
|
/**
|
|
112
133
|
* Reads a single float32 value
|
|
113
134
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
135
|
+
readFloat() {
|
|
136
|
+
let result = this.view.getFloat32(this.position, this.littleEndian);
|
|
116
137
|
this.position += 4;
|
|
117
138
|
return result;
|
|
118
|
-
}
|
|
139
|
+
}
|
|
119
140
|
/**
|
|
120
141
|
* Reads a single float64 value
|
|
121
142
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
143
|
+
readDouble() {
|
|
144
|
+
let result = this.view.getFloat64(this.position, this.littleEndian);
|
|
124
145
|
this.position += 8;
|
|
125
146
|
return result;
|
|
126
|
-
}
|
|
147
|
+
}
|
|
127
148
|
/**
|
|
128
149
|
* Jumps to the given position on the data array
|
|
129
150
|
*
|
|
130
151
|
* @param position - The new index
|
|
131
152
|
*/
|
|
132
|
-
|
|
153
|
+
seekAbsolute(position) {
|
|
133
154
|
this.position = position;
|
|
134
|
-
}
|
|
155
|
+
}
|
|
135
156
|
/**
|
|
136
157
|
* Jumps to the given position (relative to the current postion) on the data array
|
|
137
158
|
*
|
|
138
159
|
* @param position - The new relative position
|
|
139
160
|
*/
|
|
140
|
-
|
|
161
|
+
seekRelative(position) {
|
|
141
162
|
this.position += position;
|
|
142
|
-
}
|
|
163
|
+
}
|
|
143
164
|
/**
|
|
144
165
|
* Reads a string
|
|
145
166
|
*
|
|
146
167
|
* @param length - The length in bytes to read
|
|
147
168
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
169
|
+
readString(length) {
|
|
170
|
+
let result = [];
|
|
150
171
|
while (length > 0) {
|
|
151
172
|
result.push(String.fromCharCode(this.view.getUint8(this.position++)));
|
|
152
173
|
length--;
|
|
153
174
|
}
|
|
154
175
|
return result.join('');
|
|
155
|
-
}
|
|
176
|
+
}
|
|
156
177
|
/**
|
|
157
178
|
* Returns a section of the buffer starting at current position
|
|
158
179
|
*
|
|
159
180
|
* @param length - The length to slice
|
|
160
181
|
*/
|
|
161
|
-
|
|
182
|
+
slice(length) {
|
|
162
183
|
this.position += length;
|
|
163
184
|
return this.data.slice(this.position - length, this.position);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
185
|
+
}
|
|
186
|
+
subarray(type, byteLength) {
|
|
187
|
+
const result = new type(this.data, this.position, byteLength / type.BYTES_PER_ELEMENT);
|
|
167
188
|
this.position += byteLength;
|
|
168
189
|
return result;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
}());
|
|
172
|
-
export { BinaryReader };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
173
192
|
export default BinaryReader;
|
|
174
193
|
//# sourceMappingURL=BinaryReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BinaryReader.js","sourceRoot":"","sources":["../../../../src/reader/BinaryReader.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAgBvB;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAA;IAC7C,CAAC;IAOD;;;;OAIG;IACH,YAAY,IAAiB;QAV7B;;WAEG;QACI,iBAAY,GAAG,IAAI,CAAA;QAQxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA;IAC7C,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,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\n * @public\n */\nexport class BinaryReader {\n /**\n * The underlying data to read\n */\n public readonly data: ArrayBuffer\n\n /**\n * The data view allowing to access the data\n */\n public readonly view: DataView\n\n /**\n * The current position\n */\n public position: number\n\n /**\n * The number of bytes remaining to read\n */\n public get remaining() {\n return this.data.byteLength - this.position\n }\n\n /**\n * Byte order to read. Default is `true`\n */\n public littleEndian = true\n\n /**\n * Creates a new instance of {@link BinaryReader}\n *\n * @param data - The data to read\n */\n constructor(data: ArrayBuffer) {\n this.data = data\n this.view = new DataView(this.data)\n this.position = 0\n }\n\n /**\n * Checks whether the readers position has not reached the end of the buffer\n */\n public get canRead() {\n return this.position < this.data.byteLength\n }\n\n /**\n * Reads a single character from the current position without advancing the position.\n */\n public get char(): string {\n return String.fromCharCode(this.byte)\n }\n\n /**\n * Reads a single byte from the current position without advancing the position.\n */\n public get byte(): number {\n return this.data[this.position]\n }\n\n /**\n * Reads a specified number of bytes\n *\n * @param length - The number of bytes to read\n * @param output - The destination array to read into\n */\n public readBytes(length: number, output: number[] = []): number[] {\n while (length > 0) {\n output.push(this.view.getUint8(this.position++))\n length--\n }\n return output\n }\n\n /**\n * Reads a specified number of bytes as a byte array\n *\n * @param length - The number of bytes to read\n */\n public readByteArray(length: number): Int8Array {\n return new Int8Array(this.slice(length))\n }\n\n /**\n * Reads a specified number of bytes as a byte array\n *\n * @param length - The number of bytes to read\n */\n public readUByteArray(length: number): Uint8Array {\n return new Uint8Array(this.slice(length))\n }\n\n public readBuffer(buffer: number[] | Uint8Array, index: number, length: number) {\n let end = index + length\n while (index < end) {\n buffer[index++] = this.view.getUint8(this.position++)\n }\n }\n\n /**\n * Reads a single unsigned byte value\n */\n public readUByte(): number {\n return this.view.getUint8(this.position++)\n }\n\n /**\n * Reads a single signed byte value\n */\n public readByte(): number {\n return this.view.getInt8(this.position++)\n }\n\n /**\n * Reads a single unsigned short value\n */\n public readUShort(): number {\n let result = this.view.getUint16(this.position, this.littleEndian)\n this.position += 2\n return result\n }\n\n /**\n * Reads a single signed short value\n */\n public readShort(): number {\n let result = this.view.getInt16(this.position, this.littleEndian)\n this.position += 2\n return result\n }\n\n /**\n * Reads a single uint32 value\n */\n public readUInt(): number {\n let result = this.view.getUint32(this.position, this.littleEndian)\n this.position += 4\n return result\n }\n\n /**\n * Reads a single int32 value\n */\n public readInt(): number {\n let result = this.view.getInt32(this.position, this.littleEndian)\n this.position += 4\n return result\n }\n\n /**\n * Reads a two uint32 values as low and high bits.\n */\n public readLong(): number {\n let lo = this.readUInt()\n let hi = this.readUInt() << 32\n return hi + lo\n }\n\n /**\n * Reads a single float32 value\n */\n public readFloat(): number {\n let result = this.view.getFloat32(this.position, this.littleEndian)\n this.position += 4\n return result\n }\n\n /**\n * Reads a single float64 value\n */\n public readDouble(): number {\n let result = this.view.getFloat64(this.position, this.littleEndian)\n this.position += 8\n return result\n }\n\n /**\n * Jumps to the given position on the data array\n *\n * @param position - The new index\n */\n public seekAbsolute(position: number) {\n this.position = position\n }\n\n /**\n * Jumps to the given position (relative to the current postion) on the data array\n *\n * @param position - The new relative position\n */\n public seekRelative(position: number) {\n this.position += position\n }\n\n /**\n * Reads a string\n *\n * @param length - The length in bytes to read\n */\n public readString(length: number): string {\n let result = []\n while (length > 0) {\n result.push(String.fromCharCode(this.view.getUint8(this.position++)))\n length--\n }\n return result.join('')\n }\n\n /**\n * Returns a section of the buffer starting at current position\n *\n * @param length - The length to slice\n */\n public slice(length: number): ArrayBuffer {\n this.position += length\n return this.data.slice(this.position - length, this.position)\n }\n\n public subarray(type: Type<Int16Array>, byteLength: number): Int16Array\n public subarray(type: Type<Int32Array>, byteLength: number): Int32Array\n public subarray(type: Type<Int8Array>, byteLength: number): Int8Array\n public subarray(type: Type<Uint16Array>, byteLength: number): Uint16Array\n public subarray(type: Type<Uint32Array>, byteLength: number): Uint32Array\n public subarray(type: Type<Uint8Array>, byteLength: number): Uint8Array\n public subarray(type: Type<Float32Array>, byteLength: number): Float32Array\n public subarray(type: Type<Float64Array>, byteLength: number): Float64Array\n public subarray(type: any, byteLength: number): any {\n const result = new type(this.data, this.position, byteLength / type.BYTES_PER_ELEMENT)\n this.position += byteLength\n return result\n }\n}\n\nexport default BinaryReader\n"]}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the {@link TextReader} constructor
|
|
3
|
+
*/
|
|
4
|
+
export interface TextReaderOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Characters that identify a white space. Default is `' \t\r\n\f'`.
|
|
7
|
+
*/
|
|
8
|
+
whitespaces?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Characters that are identified as symbols
|
|
11
|
+
*/
|
|
12
|
+
symbols?: string;
|
|
13
|
+
}
|
|
14
|
+
export type TextCharKind = number & {
|
|
15
|
+
__kind__: 'TextCharKind';
|
|
16
|
+
};
|
|
17
|
+
export declare const TextCharKind: {
|
|
18
|
+
Whitespace: TextCharKind;
|
|
19
|
+
Symbol: TextCharKind;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A wrapper around a string. Simplifies reading arbitrary formatted text data.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export declare class TextReader {
|
|
27
|
+
private index;
|
|
28
|
+
/**
|
|
29
|
+
* Checks whether the readers position has not reached the end of the string
|
|
30
|
+
*/
|
|
31
|
+
get canRead(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the character at the current readers position.
|
|
34
|
+
*/
|
|
35
|
+
get char(): string;
|
|
36
|
+
get charCode(): number;
|
|
37
|
+
/**
|
|
38
|
+
* Gets a substring until the end of the string.
|
|
39
|
+
*/
|
|
40
|
+
get rest(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Detects whether the character at current position is a symbol
|
|
43
|
+
*/
|
|
44
|
+
get isSymbol(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Detects whether the character at current position is a whitespace
|
|
47
|
+
*/
|
|
48
|
+
get isWhitespace(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Detects whether the character at current position is a '\n'
|
|
51
|
+
*/
|
|
52
|
+
get isNewLine(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Detects whether the caracter at current position is neither whitespace nor symbol
|
|
55
|
+
*/
|
|
56
|
+
get isToken(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Detects whether the caracter at current position is [0-9]
|
|
59
|
+
*/
|
|
60
|
+
get isNumeric(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Detects whether the caracter at current position is [a-zA-Z]
|
|
63
|
+
*/
|
|
64
|
+
get isAlpha(): boolean;
|
|
65
|
+
get position(): number;
|
|
66
|
+
readonly options: TextReaderOptions;
|
|
67
|
+
protected charMap: Map<string, TextCharKind>;
|
|
68
|
+
protected cachedSets: Map<string, Set<string>>;
|
|
69
|
+
private readonly text;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new instance of {@link TextReader}
|
|
72
|
+
*
|
|
73
|
+
* @param text - The text data to read
|
|
74
|
+
*/
|
|
75
|
+
constructor(text: string, options?: TextReaderOptions);
|
|
76
|
+
private getSet;
|
|
77
|
+
/**
|
|
78
|
+
* Sets the current reader position to the given index
|
|
79
|
+
*/
|
|
80
|
+
seek(index: number): void;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the string that is in front of current position
|
|
83
|
+
*
|
|
84
|
+
* @param count - number of characters to peek
|
|
85
|
+
*/
|
|
86
|
+
peek(count?: number): string;
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param offset
|
|
90
|
+
* @param count
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
peekOffset(offset: number, count?: number): string;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the text that is in front of current position (see `readText`)
|
|
96
|
+
*/
|
|
97
|
+
peekText(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the token that is in front of current position (see `readToken`)
|
|
100
|
+
*/
|
|
101
|
+
peekToken(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Return the text from current position until next new line terminator
|
|
104
|
+
*/
|
|
105
|
+
peekLine(): string;
|
|
106
|
+
/**
|
|
107
|
+
* Moves pointer back to unread the given number of characters
|
|
108
|
+
*/
|
|
109
|
+
unread(count: number): void;
|
|
110
|
+
/**
|
|
111
|
+
* Reads the given number of characters.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* If the reader is finished reading, an empty string will be returned
|
|
115
|
+
*
|
|
116
|
+
* @returns the string that was read
|
|
117
|
+
*/
|
|
118
|
+
read(count?: number): string;
|
|
119
|
+
/**
|
|
120
|
+
* Skips initial whitespaces and then reads everything until next occurance of a whitespace
|
|
121
|
+
*
|
|
122
|
+
* @returns the string that was read
|
|
123
|
+
*/
|
|
124
|
+
readText(): string;
|
|
125
|
+
/**
|
|
126
|
+
* Skips initial whitespaces and then reads everything until next occurance of a whitespace or symbol
|
|
127
|
+
*
|
|
128
|
+
* @returns the string that was read
|
|
129
|
+
*/
|
|
130
|
+
readToken(): string;
|
|
131
|
+
/**
|
|
132
|
+
* Reads until next occurrence of a new line character and trims the result
|
|
133
|
+
*
|
|
134
|
+
* @param cb - on optional callback that will receive a new reader for the new line
|
|
135
|
+
* @returns the trimmed string that was being read
|
|
136
|
+
*/
|
|
137
|
+
readLine(cb?: (r: TextReader) => void): string;
|
|
138
|
+
/**
|
|
139
|
+
* Reads until next occurrence of a new line character
|
|
140
|
+
*
|
|
141
|
+
* @param cb - on optional callback that will receive a new reader for the new line
|
|
142
|
+
* @returns the string that was being read
|
|
143
|
+
*/
|
|
144
|
+
readLineRaw(cb?: (r: TextReader) => void): string;
|
|
145
|
+
/**
|
|
146
|
+
* Skips leading whitespaces and then reads a block that is determined by the `open` and `close` character.
|
|
147
|
+
*
|
|
148
|
+
* @param start - character set identifying the begin of a block. Usually an opening parenthesis.
|
|
149
|
+
* @param end - character set identifying the end of a block. Usually matching parenthesis.
|
|
150
|
+
* @param cb - a callback to call with a new text reader
|
|
151
|
+
*/
|
|
152
|
+
readBlock(open: string, close: string, cb?: (r: TextReader) => void): string;
|
|
153
|
+
/**
|
|
154
|
+
* Reads a sequence of characters that are in given set
|
|
155
|
+
*
|
|
156
|
+
* @param cahrSet - the allowed character set
|
|
157
|
+
* @returns the text being read
|
|
158
|
+
*/
|
|
159
|
+
readWhile(cahrSet: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Reads everything until any character from given charset occurs
|
|
162
|
+
*
|
|
163
|
+
* @param charSet - the character set
|
|
164
|
+
* @param inclusive - wheter to also read the boundary characters
|
|
165
|
+
* @returns the text being read
|
|
166
|
+
*/
|
|
167
|
+
readUntil(charSet: string, inclusive?: boolean): string;
|
|
168
|
+
/**
|
|
169
|
+
* Reads everything until the given sequence occurs
|
|
170
|
+
*
|
|
171
|
+
* @param charSet - the character sequence
|
|
172
|
+
* @param inclusive - wheter to also read the sequence at the end
|
|
173
|
+
* @returns the text being read
|
|
174
|
+
*/
|
|
175
|
+
readUntilText(sequence: string, inclusive?: boolean): string;
|
|
176
|
+
/**
|
|
177
|
+
* Skips the given number of characters
|
|
178
|
+
*
|
|
179
|
+
* @param count - the character count
|
|
180
|
+
*/
|
|
181
|
+
skip(count: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Skips all whitespace characters
|
|
184
|
+
*/
|
|
185
|
+
skipWhitespace(): void;
|
|
186
|
+
/**
|
|
187
|
+
* Skips all symbol characters
|
|
188
|
+
*/
|
|
189
|
+
skipSymbols(): void;
|
|
190
|
+
/**
|
|
191
|
+
* Skips all whitespace and symbol characters
|
|
192
|
+
*/
|
|
193
|
+
skipWhitespaceAndSymbols(): void;
|
|
194
|
+
/**
|
|
195
|
+
* Skips all characters in given character set
|
|
196
|
+
*
|
|
197
|
+
* @param charset - the characters to skip
|
|
198
|
+
*/
|
|
199
|
+
skipChars(charset: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Skips characters until the next whitespace
|
|
202
|
+
*/
|
|
203
|
+
skipUntilWhitespace(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Skips characters until the next symbol
|
|
206
|
+
*/
|
|
207
|
+
skipUntilSymbol(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Skips characters until the next whitespace or symbol
|
|
210
|
+
*/
|
|
211
|
+
skipUntilWhitespaceOrSymbol(): void;
|
|
212
|
+
/**
|
|
213
|
+
* Skips characters until occurrence of one in the given string
|
|
214
|
+
*
|
|
215
|
+
* @param charset - the characters to stop at
|
|
216
|
+
* @param consume -
|
|
217
|
+
*/
|
|
218
|
+
skipUntil(charset: string, consume?: boolean): void;
|
|
219
|
+
/**
|
|
220
|
+
* Skips forward until the occurence of given sequence
|
|
221
|
+
*
|
|
222
|
+
* @param sequence - the sequence to search for
|
|
223
|
+
* @param consume - whether to consume the found sequence
|
|
224
|
+
*/
|
|
225
|
+
skipUntilSequence(sequence: string, consume?: boolean): void;
|
|
226
|
+
/**
|
|
227
|
+
* Consumes the next token only if it matches the given value. Otherwise leaves the state untouched.
|
|
228
|
+
*/
|
|
229
|
+
accept(value: string): string;
|
|
230
|
+
/**
|
|
231
|
+
* Checks whether the value at current position equals the given value
|
|
232
|
+
*
|
|
233
|
+
* @param value
|
|
234
|
+
*/
|
|
235
|
+
assert(value: string, consume?: boolean): void;
|
|
236
|
+
/**
|
|
237
|
+
* Checks whether the value at current position equals the given value
|
|
238
|
+
*
|
|
239
|
+
* @param value
|
|
240
|
+
*/
|
|
241
|
+
assertChar(value: string, consume?: boolean): void;
|
|
242
|
+
createErrorText(offset?: number): string;
|
|
243
|
+
createReader(text: string): TextReader;
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=TextReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextReader.d.ts","sourceRoot":"","sources":["../../../../src/reader/TextReader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH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