@foxglove/cdr
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -9,3 +9,2 @@ import { EncapsulationKind } from "./EncapsulationKind"; | ||
private isCDR2; | ||
private textDecoder; | ||
/** Origin offset into stream used for alignment */ | ||
@@ -12,0 +11,0 @@ private origin; |
@@ -8,5 +8,5 @@ "use strict"; | ||
const reservedPIDs_1 = require("./reservedPIDs"); | ||
const textDecoder = new TextDecoder("utf8"); | ||
class CdrReader { | ||
constructor(data) { | ||
this.textDecoder = new TextDecoder("utf8"); | ||
/** Origin offset into stream used for alignment */ | ||
@@ -121,3 +121,3 @@ this.origin = 0; | ||
const data = new Uint8Array(this.view.buffer, this.view.byteOffset + this.offset, length - 1); | ||
const value = this.textDecoder.decode(data); | ||
const value = textDecoder.decode(data); | ||
this.offset += length; | ||
@@ -124,0 +124,0 @@ return value; |
@@ -17,3 +17,2 @@ import { EncapsulationKind } from "./EncapsulationKind"; | ||
private view; | ||
private textEncoder; | ||
private offset; | ||
@@ -20,0 +19,0 @@ /** Origin offset into stream used for alignment */ |
@@ -9,5 +9,5 @@ "use strict"; | ||
const reservedPIDs_1 = require("./reservedPIDs"); | ||
const textEncoder = new TextEncoder(); | ||
class CdrWriter { | ||
constructor(options = {}) { | ||
this.textEncoder = new TextEncoder(); | ||
if (options.buffer != undefined) { | ||
@@ -135,3 +135,3 @@ this.buffer = options.buffer; | ||
this.resizeIfNeeded(strlen + 1); | ||
this.textEncoder.encodeInto(value, new Uint8Array(this.buffer, this.offset, strlen)); | ||
textEncoder.encodeInto(value, new Uint8Array(this.buffer, this.offset, strlen)); | ||
this.view.setUint8(this.offset + strlen, 0); | ||
@@ -138,0 +138,0 @@ this.offset += strlen + 1; |
{ | ||
"name": "@foxglove/cdr", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Common Data Representation serialization and deserialization library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -29,2 +29,4 @@ import { EncapsulationKind } from "./EncapsulationKind"; | ||
const textDecoder = new TextDecoder("utf8"); | ||
export class CdrReader { | ||
@@ -36,3 +38,2 @@ private view: DataView; | ||
private isCDR2: boolean; | ||
private textDecoder = new TextDecoder("utf8"); | ||
@@ -179,3 +180,3 @@ /** Origin offset into stream used for alignment */ | ||
const data = new Uint8Array(this.view.buffer, this.view.byteOffset + this.offset, length - 1); | ||
const value = this.textDecoder.decode(data); | ||
const value = textDecoder.decode(data); | ||
this.offset += length; | ||
@@ -182,0 +183,0 @@ return value; |
@@ -13,2 +13,4 @@ import { EncapsulationKind } from "./EncapsulationKind"; | ||
const textEncoder = new TextEncoder(); | ||
export class CdrWriter { | ||
@@ -25,3 +27,2 @@ static DEFAULT_CAPACITY = 16; | ||
private view: DataView; | ||
private textEncoder = new TextEncoder(); | ||
private offset: number; | ||
@@ -172,3 +173,3 @@ /** Origin offset into stream used for alignment */ | ||
this.resizeIfNeeded(strlen + 1); | ||
this.textEncoder.encodeInto(value, new Uint8Array(this.buffer, this.offset, strlen)); | ||
textEncoder.encodeInto(value, new Uint8Array(this.buffer, this.offset, strlen)); | ||
this.view.setUint8(this.offset + strlen, 0); | ||
@@ -175,0 +176,0 @@ this.offset += strlen + 1; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
215645
3572