UNPKG

well-known-parser

Version:

A WKT/WKB/EWKT/EWKB/TWKB/GeoJSON parser and serializer

49 lines (48 loc) 1.59 kB
class e { constructor(i, t = !1) { this.buffer = i, this.position = 0, this.isBigEndian = t; } readUInt8() { const i = this.buffer.readUInt8(this.position); return this.position += 1, i; } readUInt16() { const i = this.isBigEndian ? this.buffer.readUInt16BE(this.position) : this.buffer.readUInt16LE(this.position); return this.position += 2, i; } readUInt32() { const i = this.isBigEndian ? this.buffer.readUInt32BE(this.position) : this.buffer.readUInt32LE(this.position); return this.position += 4, i; } readInt8() { const i = this.buffer.readInt8(this.position); return this.position += 1, i; } readInt16() { const i = this.isBigEndian ? this.buffer.readInt16BE(this.position) : this.buffer.readInt16LE(this.position); return this.position += 2, i; } readInt32() { const i = this.isBigEndian ? this.buffer.readInt32BE(this.position) : this.buffer.readInt32LE(this.position); return this.position += 4, i; } readFloat() { const i = this.isBigEndian ? this.buffer.readFloatBE(this.position) : this.buffer.readFloatLE(this.position); return this.position += 4, i; } readDouble() { const i = this.isBigEndian ? this.buffer.readDoubleBE(this.position) : this.buffer.readDoubleLE(this.position); return this.position += 8, i; } readVarInt() { let i, t = 0, s = 0; do i = this.buffer[this.position + s], t += (i & 127) << 7 * s, s++; while (i >= 128); return this.position += s, t; } } export { e as BinaryReader }; //# sourceMappingURL=well-known-parser14.js.map