back to ext
wxMemoryBuffer
generated from ../src/mod_ext/jsmembuf.cpp
A wxMemoryBuffer is a useful data structure for storing arbitrary sized blocks of memory.
You can access the data of the buffer as a JavaScript array.
For example:
var buffer = new wxMemoryBuffer(10);
buffer[0] = 10;
buffer[1] = 'a';
Constants
Constructor
wxMemoryBuffer
wxMemoryBuffer(Size = 0)
| Name |
Type |
Default |
Description |
| Size |
Integer |
0 |
The size of the buffer |
wxMemoryBuffer(Str,
Encoding = UTF-16)
| Name |
Type |
Default |
Description |
| Str |
String |
|
A string to fill the buffer |
| Encoding |
String |
UTF-16 |
The encoding to use to put this string in the buffer |
Creates a new wxMemoryBuffer object with the given size or with
string as content.
Properties
| Name |
Type |
Description |
| bufSize |
Integer |
Get/Set the size of the buffer.
|
| dataLen |
Integer |
Get/Set the length of the data in the buffer. The length of the data
can be less then the length of the buffer.
|
isNull  |
Boolean |
Is the buffer null? (dataLen and bufSize are 0).
|
Methods
append
append(Byte)
| Name |
Type |
Default |
Description |
| Byte |
integer |
|
The byte to add |
append(Buffer,
Size = Buffer.size)
| Name |
Type |
Default |
Description |
| Buffer |
wxMemoryBuffer |
|
The buffer to add |
| Size |
Integer |
Buffer.size |
The size of the buffer to add. When not set, the full buffer is added. |
Concatenate a byte or buffer to this buffer.
toString
toString(Encoding = UTF-16) : String
| Name |
Type |
Default |
Description |
| Encoding |
String |
UTF-16 |
The encoding of the string in this buffer.
|
Converts the content in the buffer to a String.
The default encoding is UTF-16 because in JavaScript all strings
are stored in UTF-16. A conversion is done to UTF-16,
when another encoding is specified.