Moai SDK
2.0
|
Inherits MOAILuaObject.
Function List | |
base64Decode | |
base64Encode | |
clear | |
deflate | |
getSize | |
getString | |
hexDecode | |
hexEncode | |
inflate | |
load | |
loadAsync | |
save | |
saveAsync | |
setString | |
toCppHeader | |
|
If a string is provided, decodes it as a base64 encoded string. Otherwise, decodes the current data stored in this object as a base64 encoded sequence of characters.
function base64Decode ( [ MOAIDataBuffer self, string data ] )
MOAIDataBuffer | self Optional. |
string | data Optional. The string data to decode. You must either provide either a MOAIDataBuffer (via a :base64Decode type call) or string data (via a .base64Decode type call), but not both. |
|
If a string is provided, encodes it in base64. Otherwise, encodes the current data stored in this object as a base64 encoded sequence of characters.
function base64Encode ( [ MOAIDataBuffer self, string data ] )
MOAIDataBuffer | self Optional. |
string | data Optional. The string data to encode. You must either provide either a MOAIDataBuffer (via a :base64Encode type call) or string data (via a .base64Encode type call), but not both. |
|
Release the data buffer's memory.
function clear ( MOAIDataBuffer self )
MOAIDataBuffer | self |
|
Compresses the string or the current data stored in this object using the DEFLATE algorithm.
function deflate ( string data [, number level, number windowBits ] )
string | data The string data to deflate. |
number | level Optional. The level used in the DEFLATE algorithm. |
number | windowBits Optional. The window bits used in the DEFLATE algorithm. |
function deflate ( MOAIDataBuffer self [, number level, number windowBits ] )
MOAIDataBuffer | self |
number | level Optional. The level used in the DEFLATE algorithm. |
number | windowBits Optional. The window bits used in the DEFLATE algorithm. |
|
Returns the number of bytes in this data buffer object.
function getSize ( MOAIDataBuffer self )
MOAIDataBuffer | self |
|
Returns the contents of the data buffer object as a string value.
function getString ( MOAIDataBuffer self )
MOAIDataBuffer | self |
|
If a string is provided, decodes it as a hex encoded string. Otherwise, decodes the current data stored in this object as a hex encoded sequence of bytes.
function hexDecode ( [ MOAIDataBuffer self, string data ] )
MOAIDataBuffer | self Optional. |
string | data Optional. The string data to decode. You must either provide either a MOAIDataBuffer (via a :hexDecode type call) or string data (via a .hexDecode type call), but not both. |
|
If a string is provided, encodes it in hex. Otherwise, encodes the current data stored in this object as a hex encoded sequence of characters.
function hexEncode ( [ MOAIDataBuffer self, string data ] )
MOAIDataBuffer | self Optional. |
string | data Optional. The string data to encode. You must either provide either a MOAIDataBuffer (via a :hexEncode type call) or string data (via a .hexEncode type call), but not both. |
|
Decompresses the string or the current data stored in this object using the DEFLATE algorithm.
function inflate ( string data [, number windowBits ] )
string | data The string data to inflate. |
number | windowBits Optional. The window bits used in the DEFLATE algorithm. |
function inflate ( MOAIDataBuffer self [, number windowBits ] )
MOAIDataBuffer | self |
number | windowBits Optional. The window bits used in the DEFLATE algorithm. |
|
Copies the data from the given file into this object. This method is a synchronous operation and will block until the file is loaded.
function load ( MOAIDataBuffer self, string filename [, number detectZip, number windowBits ] )
MOAIDataBuffer | self |
string | filename The path to the file that the data should be loaded from. |
number | detectZip Optional. One of MOAIDataBuffer.NO_INFLATE, MOAIDataBuffer.FORCE_INFLATE, MOAIDataBuffer.INFLATE_ON_EXT |
number | windowBits Optional. The window bits used in the DEFLATE algorithm. Pass nil to use the default value. |
|
Asynchronously copies the data from the given file into this object. This method is an asynchronous operation and will return immediately.
function loadAsync ( MOAIDataBuffer self, string filename, MOAITaskQueue queue [, function callback, number detectZip, boolean inflateAsync, number windowBits ] )
MOAIDataBuffer | self |
string | filename The path to the file that the data should be loaded from. |
MOAITaskQueue | queue The queue to perform the loading operation. |
function | callback Optional. The function to be called when the asynchronous operation is complete. The MOAIDataBuffer is passed as the first parameter. |
number | detectZip Optional. One of MOAIDataBuffer.NO_INFLATE, MOAIDataBuffer.FORCE_INFLATE, MOAIDataBuffer.INFLATE_ON_EXT |
boolean | inflateAsync Optional. 'true' to inflate on task thread. 'false' to inflate on subscriber thread. Default value is 'true.' |
number | windowBits Optional. The window bits used in the DEFLATE algorithm. Pass nil to use the default value. |
|
Saves the data in this object to the given file. This method is a synchronous operation and will block until the data is saved.
function save ( MOAIDataBuffer self, string filename )
MOAIDataBuffer | self |
string | filename The path to the file that the data should be saved to. |
|
Asynchronously saves the data in this object to the given file. This method is an asynchronous operation and will return immediately.
function saveAsync ( MOAIDataBuffer self, string filename, MOAITaskQueue queue [, function callback ] )
MOAIDataBuffer | self |
string | filename The path to the file that the data should be saved to. |
MOAITaskQueue | queue The queue to perform the saving operation. |
function | callback Optional. The function to be called when the asynchronous operation is complete. The MOAIDataBuffer is passed as the first parameter. |
|
Replaces the contents of this object with the string specified.
function setString ( MOAIDataBuffer self, string data )
MOAIDataBuffer | self |
string | data The string data to replace the contents of this object with. |
|
Convert data to CPP header file.
function toCppHeader ( string data, string name [, number columns ] )
string | data The string data to encode |
string | name |
number | columns Optional. Default value is 12 |
function toCppHeader ( MOAIDataBuffer data, string name [, number columns ] )
MOAIDataBuffer | data The data buffer to encode |
string | name |
number | columns Optional. Default value is 12 |