node-opcua-binary-stream
Advanced tools
Comparing version 0.4.6 to 0.5.0
@@ -0,1 +1,198 @@ | ||
/// <reference types="node" /> | ||
import "util"; | ||
/** | ||
* a BinaryStream can be use to perform sequential read or write | ||
* inside a buffer. | ||
* The BinaryStream maintains a cursor up to date as the caller | ||
* operates on the stream using the various read/write methods. | ||
* It uses the [Little Endian](http://en.wikipedia.org/wiki/Little_endian#Little-endian) | ||
* convention. | ||
* | ||
* data can either be: | ||
* | ||
* * a Buffer , in this case the BinaryStream operates on this Buffer | ||
* * null , in this case a BinaryStream with 1024 bytes is created | ||
* * any data , in this case the object is converted into a binary buffer. | ||
* | ||
* example: | ||
* | ||
* ``` javascript | ||
* var stream = new BinaryStream(32) | ||
* ``` | ||
* | ||
* @class BinaryStream | ||
* @param {null|Buffer|Number} data | ||
* @constructor | ||
* | ||
* | ||
* | ||
*/ | ||
export declare class BinaryStream { | ||
_buffer: Buffer; | ||
length: number; | ||
constructor(data: undefined | Buffer | number); | ||
/** | ||
* set the cursor to the begining of the stream | ||
* @method BinaryStream.rewind | ||
* @return null | ||
*/ | ||
rewind(): void; | ||
/** | ||
* write a single signed byte (8 bits) to the stream. | ||
* value must be in the range of [-127,128] | ||
* @method writeInt8 | ||
* @param value | ||
*/ | ||
writeInt8(value: number): void; | ||
/** | ||
* write a single unsigned byte (8 bits) to the stream. | ||
* @method writeUInt8 | ||
* @param value | ||
*/ | ||
writeUInt8(value: number): void; | ||
/** | ||
* write a single 16 bit signed integer to the stream. | ||
* @method writeInt16 | ||
* @param value | ||
*/ | ||
writeInt16(value: number): void; | ||
/** | ||
* write a single 16 bit unsigned integer to the stream. | ||
* @method writeUInt16 | ||
* @param value | ||
*/ | ||
writeUInt16(value: number): void; | ||
/** | ||
* write a single 32 bit signed integer to the stream. | ||
* @method writeInteger | ||
* @param value | ||
*/ | ||
writeInteger(value: number): void; | ||
/** | ||
* write a single 32 bit unsigned integer to the stream. | ||
* @method writeUInt32 | ||
* @param value | ||
*/ | ||
writeUInt32(value: number): void; | ||
/** | ||
* write a single 32 bit floating number to the stream. | ||
* @method writeFloat | ||
* @param value | ||
*/ | ||
writeFloat(value: number): void; | ||
/** | ||
* write a single 64 bit floating number to the stream. | ||
* @method writeDouble | ||
* @param value | ||
*/ | ||
writeDouble(value: number): void; | ||
/** | ||
* @method writeArrayBuffer | ||
* @param arrayBuf {ArrayBuffer} | ||
* @param offset {Number} | ||
* @param length {Number} | ||
*/ | ||
writeArrayBuffer(arrayBuf: ArrayBuffer, offset?: number, length?: number): void; | ||
/** | ||
* read a single signed byte (8 bits) from the stream. | ||
* @method readByte | ||
* @return {Number} | ||
*/ | ||
readByte(): number; | ||
readInt8(): number; | ||
/** | ||
* read a single unsigned byte (8 bits) from the stream. | ||
* @method readUInt8 | ||
* @return {Number} | ||
*/ | ||
readUInt8(): number; | ||
/** | ||
* read a single signed 16-bit integer from the stream. | ||
* @method readInt16 | ||
* @return {Number} | ||
*/ | ||
readInt16(): number; | ||
/** | ||
* read a single unsigned 16-bit integer from the stream. | ||
* @method readUInt16 | ||
* @return {Number} q | ||
*/ | ||
readUInt16(): number; | ||
/** | ||
* read a single signed 32-bit integer from the stream. | ||
* @method readInteger | ||
* @return {Number} | ||
*/ | ||
readInteger(): number; | ||
/** | ||
* read a single unsigned 32-bit integer from the stream. | ||
* @method readUInt32 | ||
* @return {number} the value read from the stream | ||
*/ | ||
readUInt32(): number; | ||
/** | ||
* read a single 32-bit floating point number from the stream. | ||
* @method readFloat | ||
* @return the value read from the stream | ||
*/ | ||
readFloat(): number; | ||
/** | ||
* read a single 64-bit floating point number from the stream. | ||
* @method readDouble | ||
* @return the value read from the stream | ||
*/ | ||
readDouble(): number; | ||
/** | ||
* write a byte stream to the stream. | ||
* The method writes the length of the byte array into the stream as a 32 bits integer before the byte stream. | ||
* | ||
* @method writeByteStream | ||
* @param {Buffer} buf the buffer to write. | ||
* the buffer buf.length the buffer to write | ||
*/ | ||
writeByteStream(buf: Buffer): void; | ||
writeString(value: string): void; | ||
/** | ||
* @method readArrayBuffer | ||
* @param length | ||
* @returns {Uint8Array} | ||
*/ | ||
readArrayBuffer(length: number): Uint8Array; | ||
/** | ||
* read a byte stream to the stream. | ||
* The method reads the length of the byte array from the stream as a 32 bits integer before reading the byte stream. | ||
* | ||
* @method readByteStream | ||
* @return {Buffer} | ||
*/ | ||
readByteStream(): Buffer | null; | ||
readString(): string | null; | ||
} | ||
/** | ||
* a BinaryStreamSizeCalculator can be used to quickly evaluate the required size | ||
* of a buffer by performing the same sequence of write operation. | ||
* | ||
* a BinaryStreamSizeCalculator has the same writeXXX methods as the BinaryStream stream | ||
* object. | ||
* | ||
* @class BinaryStreamSizeCalculator | ||
* @extends BinaryStream | ||
* @constructor | ||
* | ||
*/ | ||
export declare class BinaryStreamSizeCalculator { | ||
length: number; | ||
constructor(); | ||
rewind(): void; | ||
writeInt8(value: number): void; | ||
writeUInt8(value: number): void; | ||
writeInt16(value: number): void; | ||
writeInteger(value: number): void; | ||
writeUInt32(value: number): void; | ||
writeUInt16(value: number): void; | ||
writeFloat(value: number): void; | ||
writeDouble(value: number): void; | ||
writeArrayBuffer(arrayBuf: ArrayBuffer, offset: number, byteLength: number): void; | ||
writeByteStream(buf: Buffer): void; | ||
writeString(str: string): void; | ||
} |
@@ -401,2 +401,3 @@ "use strict"; | ||
} | ||
exports.BinaryStream = BinaryStream; | ||
/** | ||
@@ -426,3 +427,2 @@ * @function calculateByteLength | ||
const zeroLengthBuffer = node_opcua_buffer_utils_1.createFastUninitializedBuffer(0); | ||
exports.BinaryStream = BinaryStream; | ||
/** | ||
@@ -429,0 +429,0 @@ * a BinaryStreamSizeCalculator can be used to quickly evaluate the required size |
{ | ||
"name": "node-opcua-binary-stream", | ||
"version": "0.4.6", | ||
"version": "0.5.0", | ||
"description": "pure nodejs OPCUA SDK - module -binary-stream", | ||
@@ -13,4 +13,4 @@ "main": "dist/binaryStream.js", | ||
"colors": "^1.3.2", | ||
"node-opcua-assert": "^0.4.6", | ||
"node-opcua-buffer-utils": "^0.4.6", | ||
"node-opcua-assert": "^0.5.0", | ||
"node-opcua-buffer-utils": "^0.5.0", | ||
"underscore": "^1.9.1" | ||
@@ -20,3 +20,3 @@ }, | ||
"@types/underscore": "^1.8.9", | ||
"node-opcua-benchmarker": "^0.4.6", | ||
"node-opcua-benchmarker": "^0.5.0", | ||
"should": "13.2.3" | ||
@@ -39,3 +39,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "537d2a1f4d88271c57389d8ed56d787cf67588d2" | ||
"gitHead": "7c2f2dcb6ebdc49e57da1a028406a307df502d4e" | ||
} |
@@ -40,3 +40,3 @@ /** | ||
*/ | ||
class BinaryStream { | ||
export class BinaryStream { | ||
_buffer: Buffer; | ||
@@ -445,3 +445,2 @@ length: number; | ||
const zeroLengthBuffer = createFastUninitializedBuffer(0); | ||
exports.BinaryStream = BinaryStream; | ||
@@ -460,3 +459,3 @@ /** | ||
*/ | ||
class BinaryStreamSizeCalculator { | ||
export class BinaryStreamSizeCalculator { | ||
length: number; | ||
@@ -530,2 +529,1 @@ | ||
exports.BinaryStreamSizeCalculator = BinaryStreamSizeCalculator; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63504
1433
+ Addednode-opcua-assert@0.5.0(transitive)
+ Addednode-opcua-buffer-utils@0.5.6(transitive)
- Removednode-opcua-assert@0.4.6(transitive)
- Removednode-opcua-buffer-utils@0.4.6(transitive)
Updatednode-opcua-assert@^0.5.0