Class outputBuffer
outputBuffer
Defined in: outputBuffer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
outputBuffers, like inputBuffers assist in working with raw binary data
as a basic datastream.
|
Field Attributes | Field Name and Description |
---|---|
The total size of the data written to the outputBuffer in bytes.
|
Method Attributes | Method Name and Description |
---|---|
clear()
Removes all written bytes to the outputBuffer and puts the outputBuffer in a default state.
|
|
commit(path)
Writes a file containing exactly the bytes written to the outputBuffer
|
|
getData()
Returns a copy of the written data as an array of raw byte values.
|
|
write(type, data)
Appends the data to the outputBuffer.
|
|
writeBytes(bytes)
Appends the given byte data to the outputBuffer.
|
|
writeString(string)
Appends the given string to the outputBuffer.
|
Class Detail
outputBuffer()
outputBuffers, like inputBuffers assist in working with raw binary data
as a basic datastream. Much of its functionality mimics inputBuffer, but with
write-only equivalents
// Creates a new, empty outputBuffer. var myBuffer = sandboxe.outputBuffer.create(); // Writes a decimal value to the outputBuffer. (standard single precision of 4 bytes) myBuffer.write(sandboxe.type.float, 3.14); // Writes a string to the buffer as well myBuffer.writeString('Hello, world!'); // Send all written data to a binary file myBuffer.commit('binaryFile');
Field Detail
size
The total size of the data written to the outputBuffer in bytes.
Method Detail
clear()
Removes all written bytes to the outputBuffer and puts the outputBuffer in a default state.
commit(path)
Writes a file containing exactly the bytes written to the outputBuffer
- Parameters:
- {String} path
- The path to write the file to.
{Array}
getData()
Returns a copy of the written data as an array of raw byte values.
This does not modify the outputBuffer in any way.
- Returns:
- {Array} An array of raw byte values.
write(type, data)
Appends the data to the outputBuffer.
- Parameters:
- {Number} type
- Refer to sandboxe.type for valid values to be read.
- {Number} data
- The data to write to the outputBuffer
writeBytes(bytes)
Appends the given byte data to the outputBuffer.
- Parameters:
- {Array} bytes
- The array of byte values to write.
writeString(string)
Appends the given string to the outputBuffer. Only the UTF8 data is
written to the string.
- Parameters:
- {String} string
- The string object to write.