node-opcua-binary-stream 2.66.0 → 2.71.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.
@@ -1,159 +1,159 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-binary-stream
4
- */
5
- import "util";
6
- /**
7
- * a BinaryStream can be use to perform sequential read or write
8
- * inside a buffer.
9
- * The BinaryStream maintains a cursor up to date as the caller
10
- * operates on the stream using the various read/write methods.
11
- * It uses the [Little Endian](http://en.wikipedia.org/wiki/Little_endian#Little-endian)
12
- * It uses the [Little Endian](http://en.wikipedia.org/wiki/Little_endian#Little-endian)
13
- * convention.
14
- *
15
- * data can either be:
16
- *
17
- * * a Buffer , in this case the BinaryStream operates on this Buffer
18
- * * null , in this case a BinaryStream with 1024 bytes is created
19
- * * any data , in this case the object is converted into a binary buffer.
20
- *
21
- * example:
22
- *
23
- * ``` javascript
24
- * var stream = new BinaryStream(32)
25
- * ```
26
- *
27
- * @class BinaryStream
28
- * @param {null|Buffer|Number} data
29
- * @constructor
30
- *
31
- *
32
- *
33
- */
34
- export declare class BinaryStream {
35
- /**
36
- * the current position inside the buffer
37
- */
38
- length: number;
39
- /**
40
- * @internal
41
- */
42
- buffer: Buffer;
43
- constructor(data: undefined | Buffer | number);
44
- /**
45
- * set the cursor to the begining of the stream
46
- * @method BinaryStream.rewind
47
- */
48
- rewind(): void;
49
- /**
50
- * write a single signed byte (8 bits) to the stream.
51
- * value must be in the range of [-127,128]
52
- * @param value the value to write
53
- */
54
- writeInt8(value: number): void;
55
- /**
56
- * write a single unsigned byte (8 bits) to the stream.
57
- * @param value the value to write
58
- */
59
- writeUInt8(value: number): void;
60
- /**
61
- * write a single 16 bit signed integer to the stream.
62
- * @param value the value to write
63
- */
64
- writeInt16(value: number): void;
65
- /**
66
- * write a single 16 bit unsigned integer to the stream.
67
- * @param value the value to write
68
- */
69
- writeUInt16(value: number): void;
70
- /**
71
- * write a single 32 bit signed integer to the stream.
72
- * @param value the value to write
73
- */
74
- writeInteger(value: number): void;
75
- /**
76
- * write a single 32 bit unsigned integer to the stream.
77
- *
78
- * @param value the value to write
79
- */
80
- writeUInt32(value: number): void;
81
- /**
82
- * write a single 32 bit floating number to the stream.
83
- * @param value the value to write
84
- */
85
- writeFloat(value: number): void;
86
- /**
87
- * write a single 64 bit floating number to the stream.
88
- * @param value the value to write
89
- */
90
- writeDouble(value: number): void;
91
- /**
92
- * @param arrayBuf a buffer or byte array write
93
- * @param offset the offset position (default =0)
94
- * @param length the number of byte to write
95
- */
96
- writeArrayBuffer(arrayBuf: ArrayBuffer, offset?: number, length?: number): void;
97
- /**
98
- * read a single signed byte (8 bits) from the stream.
99
- * @return the value read
100
- */
101
- readByte(): number;
102
- readInt8(): number;
103
- /**
104
- * read a single unsigned byte (8 bits) from the stream.
105
- */
106
- readUInt8(): number;
107
- /**
108
- * read a single signed 16-bit integer from the stream.
109
- */
110
- readInt16(): number;
111
- /**
112
- * read a single unsigned 16-bit integer from the stream.
113
- */
114
- readUInt16(): number;
115
- /**
116
- * read a single signed 32-bit integer from the stream.
117
- */
118
- readInteger(): number;
119
- /**
120
- * read a single unsigned 32-bit integer from the stream.
121
- */
122
- readUInt32(): number;
123
- /**
124
- * read a single 32-bit floating point number from the stream.
125
- */
126
- readFloat(): number;
127
- /**
128
- * read a single 64-bit floating point number from the stream.
129
- */
130
- readDouble(): number;
131
- /**
132
- * write a byte stream to the stream.
133
- * The method writes the length of the byte array into the stream as a 32 bits integer before the byte stream.
134
- *
135
- * @param buf the buffer to write.
136
- */
137
- writeByteStream(buf: Buffer): void;
138
- writeString(value: null | string): void;
139
- /**
140
- * @method readArrayBuffer
141
- * @param length
142
- */
143
- readArrayBuffer(length: number): Uint8Array;
144
- /**
145
- * read a byte stream to the stream.
146
- * The method reads the length of the byte array from the stream as a 32 bits integer
147
- * before reading the byte stream.
148
- *
149
- */
150
- readByteStream(): Buffer | null;
151
- readString(): string | null;
152
- }
153
- /**
154
- * @function calculateByteLength
155
- * calculate the size in bytes of a utf8 string
156
- * @param str {String}
157
- * @internal
158
- */
159
- export declare function calculateByteLength(str: string): number;
1
+ /// <reference types="node" />
2
+ /**
3
+ * @module node-opcua-binary-stream
4
+ */
5
+ import "util";
6
+ /**
7
+ * a BinaryStream can be use to perform sequential read or write
8
+ * inside a buffer.
9
+ * The BinaryStream maintains a cursor up to date as the caller
10
+ * operates on the stream using the various read/write methods.
11
+ * It uses the [Little Endian](http://en.wikipedia.org/wiki/Little_endian#Little-endian)
12
+ * It uses the [Little Endian](http://en.wikipedia.org/wiki/Little_endian#Little-endian)
13
+ * convention.
14
+ *
15
+ * data can either be:
16
+ *
17
+ * * a Buffer , in this case the BinaryStream operates on this Buffer
18
+ * * null , in this case a BinaryStream with 1024 bytes is created
19
+ * * any data , in this case the object is converted into a binary buffer.
20
+ *
21
+ * example:
22
+ *
23
+ * ``` javascript
24
+ * var stream = new BinaryStream(32)
25
+ * ```
26
+ *
27
+ * @class BinaryStream
28
+ * @param {null|Buffer|Number} data
29
+ * @constructor
30
+ *
31
+ *
32
+ *
33
+ */
34
+ export declare class BinaryStream {
35
+ /**
36
+ * the current position inside the buffer
37
+ */
38
+ length: number;
39
+ /**
40
+ * @internal
41
+ */
42
+ buffer: Buffer;
43
+ constructor(data: undefined | Buffer | number);
44
+ /**
45
+ * set the cursor to the begining of the stream
46
+ * @method BinaryStream.rewind
47
+ */
48
+ rewind(): void;
49
+ /**
50
+ * write a single signed byte (8 bits) to the stream.
51
+ * value must be in the range of [-127,128]
52
+ * @param value the value to write
53
+ */
54
+ writeInt8(value: number): void;
55
+ /**
56
+ * write a single unsigned byte (8 bits) to the stream.
57
+ * @param value the value to write
58
+ */
59
+ writeUInt8(value: number): void;
60
+ /**
61
+ * write a single 16 bit signed integer to the stream.
62
+ * @param value the value to write
63
+ */
64
+ writeInt16(value: number): void;
65
+ /**
66
+ * write a single 16 bit unsigned integer to the stream.
67
+ * @param value the value to write
68
+ */
69
+ writeUInt16(value: number): void;
70
+ /**
71
+ * write a single 32 bit signed integer to the stream.
72
+ * @param value the value to write
73
+ */
74
+ writeInteger(value: number): void;
75
+ /**
76
+ * write a single 32 bit unsigned integer to the stream.
77
+ *
78
+ * @param value the value to write
79
+ */
80
+ writeUInt32(value: number): void;
81
+ /**
82
+ * write a single 32 bit floating number to the stream.
83
+ * @param value the value to write
84
+ */
85
+ writeFloat(value: number): void;
86
+ /**
87
+ * write a single 64 bit floating number to the stream.
88
+ * @param value the value to write
89
+ */
90
+ writeDouble(value: number): void;
91
+ /**
92
+ * @param arrayBuf a buffer or byte array write
93
+ * @param offset the offset position (default =0)
94
+ * @param length the number of byte to write
95
+ */
96
+ writeArrayBuffer(arrayBuf: ArrayBuffer, offset?: number, length?: number): void;
97
+ /**
98
+ * read a single signed byte (8 bits) from the stream.
99
+ * @return the value read
100
+ */
101
+ readByte(): number;
102
+ readInt8(): number;
103
+ /**
104
+ * read a single unsigned byte (8 bits) from the stream.
105
+ */
106
+ readUInt8(): number;
107
+ /**
108
+ * read a single signed 16-bit integer from the stream.
109
+ */
110
+ readInt16(): number;
111
+ /**
112
+ * read a single unsigned 16-bit integer from the stream.
113
+ */
114
+ readUInt16(): number;
115
+ /**
116
+ * read a single signed 32-bit integer from the stream.
117
+ */
118
+ readInteger(): number;
119
+ /**
120
+ * read a single unsigned 32-bit integer from the stream.
121
+ */
122
+ readUInt32(): number;
123
+ /**
124
+ * read a single 32-bit floating point number from the stream.
125
+ */
126
+ readFloat(): number;
127
+ /**
128
+ * read a single 64-bit floating point number from the stream.
129
+ */
130
+ readDouble(): number;
131
+ /**
132
+ * write a byte stream to the stream.
133
+ * The method writes the length of the byte array into the stream as a 32 bits integer before the byte stream.
134
+ *
135
+ * @param buf the buffer to write.
136
+ */
137
+ writeByteStream(buf: Buffer): void;
138
+ writeString(value: null | string): void;
139
+ /**
140
+ * @method readArrayBuffer
141
+ * @param length
142
+ */
143
+ readArrayBuffer(length: number): Uint8Array;
144
+ /**
145
+ * read a byte stream to the stream.
146
+ * The method reads the length of the byte array from the stream as a 32 bits integer
147
+ * before reading the byte stream.
148
+ *
149
+ */
150
+ readByteStream(): Buffer | null;
151
+ readString(): string | null;
152
+ }
153
+ /**
154
+ * @function calculateByteLength
155
+ * calculate the size in bytes of a utf8 string
156
+ * @param str {String}
157
+ * @internal
158
+ */
159
+ export declare function calculateByteLength(str: string): number;