Skip to main content

Buffer

A byte buffer object

warning

This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.


getLength()

Returns length of this buffer

getLength()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

getMaxCapacity()

Returns max capacity this buffer can have

getMaxCapacity()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

setPosition()

Sets current position of this buffer

setPosition(position)

Parameters:

NameTypeDescriptionDefault
positionInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

getPosition()

Returns current position of this buffer

getPosition()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

available()

Returns amount of bytes available to read

available()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

clear()

figura.docs.clear

clear()

Returns:

TypeDescription
nil-

Example:

-- example coming soon

close()

Closes this buffer, marking it's memory to be freed by garbage collector. After calling this function buffer cant be used anymore

close()

Returns:

TypeDescription
nil-

Example:

-- example coming soon

isClosed()

Checks, is this buffer closed or not

isClosed()

Returns:

TypeDescription
Boolean-

Example:

-- example coming soon

read()

Reads one byte from this buffer

read()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readBase64()

Reads bytes from this buffer to a Base64 string. Length is amount of bytes to read, default length is 1024

readBase64()

Returns:

TypeDescription
String-

Example:

-- example coming soon

readByteArray()

Reads bytes from this buffer to a string byte array. Length is amount of bytes to read, default length is 1024

readByteArray()

Returns:

TypeDescription
String-

Example:

-- example coming soon

readDouble()

Reads double from this buffer

readDouble()

Returns:

TypeDescription
Number-

Example:

-- example coming soon

readDoubleLE()

Reads little endian double from this buffer

readDoubleLE()

Returns:

TypeDescription
Number-

Example:

-- example coming soon

readFloat()

Reads float from this buffer

readFloat()

Returns:

TypeDescription
Number-

Example:

-- example coming soon

readFloatLE()

Reads little endian float from this buffer

readFloatLE()

Returns:

TypeDescription
Number-

Example:

-- example coming soon

readFromStream()

Reads data from provided input stream and writes it to buffer, returns amount of bytes wrote

readFromStream(stream, amount)

Parameters:

NameTypeDescriptionDefault
streamInputStream--
amountInteger--

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readInt()

Reads integer from this buffer

readInt()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readIntLE()

Reads little endian integer from this buffer

readIntLE()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readLong()

Reads long from this buffer

readLong()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readLongLE()

Reads little endian long from this buffer

readLongLE()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readShort()

Reads short from this buffer

readShort()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readShortLE()

Reads little endian short from this buffer

readShortLE()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readString()

Reads a string from this buffer. Default encoding is UTF8. Length is amount of bytes to read

readString()

Returns:

TypeDescription
String-

Example:

-- example coming soon

readUShort()

Reads unsigned short from this buffer

readUShort()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

readUShortLE()

Reads little endian unsigned short from this buffer

readUShortLE()

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

write()

Writes one byte to this buffer

write(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeBase64()

Writes bytes of Base64 string to this buffer and returns amount of bytes written.

writeBase64(base64)

Parameters:

NameTypeDescriptionDefault
base64String--

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

writeByteArray()

Writes raw bytes of string to this buffer and returns amount of bytes written.

writeByteArray(array)

Parameters:

NameTypeDescriptionDefault
arrayString--

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

writeDouble()

Writes double to this buffer

writeDouble(val)

Parameters:

NameTypeDescriptionDefault
valNumber--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeDoubleLE()

Writes little endian double to this buffer

writeDoubleLE(val)

Parameters:

NameTypeDescriptionDefault
valNumber--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeFloat()

Writes float to this buffer

writeFloat(val)

Parameters:

NameTypeDescriptionDefault
valNumber--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeFloatLE()

Writes little endian float to this buffer

writeFloatLE(val)

Parameters:

NameTypeDescriptionDefault
valNumber--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeInt()

Writes integer to this buffer

writeInt(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeIntLE()

Writes little endian integer to this buffer

writeIntLE(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeLong()

Writes long to this buffer

writeLong(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeLongLE()

Writes little endian long to this buffer

writeLongLE(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeShort()

Writes short to this buffer

writeShort(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeShortLE()

Writes little endian short to this buffer

writeShortLE(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeString()

Writes a string to this buffer and returns amount of bytes written. Default encoding is UTF8.

writeString(val)

Parameters:

NameTypeDescriptionDefault
valString--

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

writeToStream()

Writes data from this buffer to provided output stream

writeToStream(stream, amount)

Parameters:

NameTypeDescriptionDefault
streamOutputStream--
amountInteger--

Returns:

TypeDescription
Integer-

Example:

-- example coming soon

writeUShort()

Writes unsigned short to this buffer

writeUShort(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon

writeUShortLE()

Writes little endian unsigned short to this buffer

writeUShortLE(val)

Parameters:

NameTypeDescriptionDefault
valInteger--

Returns:

TypeDescription
nil-

Example:

-- example coming soon