Buffer

A byte buffer object

Buffer.getLength

Returns length of this buffer
overload 1:
Buffer:getLength()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.clear

figura.docs.clear
overload 1:
Buffer:clear()
Method Property Fluent Description Representation
Return Value nil

Buffer.write

figura.docs.buffer.write_byte
overload 1:
Buffer:write(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.read

Reads one byte from this buffer
overload 1:
Buffer:read()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.close

Closes this buffer, marking it's memory to be freed by garbage collector. After calling this function buffer cant be used anymore
overload 1:
Buffer:close()
Method Property Fluent Description Representation
Return Value nil

Buffer.writeInt

Writes integer to this buffer
overload 1:
Buffer:writeInt(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.readInt

Reads integer from this buffer
overload 1:
Buffer:readInt()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.available

Returns amount of bytes available to read
overload 1:
Buffer:available()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.writeFloat

Writes float to this buffer
overload 1:
Buffer:writeFloat(val)
Method Property Fluent Description Representation
val accepts a Number
Return Value nil

Buffer.readFloat

Reads float from this buffer
overload 1:
Buffer:readFloat()
Method Property Fluent Description Representation
Return Value a Number

Buffer.readLong

Reads long from this buffer
overload 1:
Buffer:readLong()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.readShort

Reads short from this buffer
overload 1:
Buffer:readShort()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.readString

Reads a string from this buffer. Default encoding is UTF8. Length is amount of bytes to read
overload 1:
Buffer:readString()
Method Property Fluent Description Representation
Return Value a String
overload 2:
Buffer:readString(length)
Method Property Fluent Description Representation
length accepts an Integer
Return Value a String
overload 3:
Buffer:readString(length, encoding)
Method Property Fluent Description Representation
length accepts an Integer
encoding accepts a String
Return Value a String

Buffer.writeString

Writes a string to this buffer and returns amount of bytes written. Default encoding is UTF8.
overload 1:
Buffer:writeString(val)
Method Property Fluent Description Representation
val accepts a String
Return Value an Integer
overload 2:
Buffer:writeString(val, encoding)
Method Property Fluent Description Representation
val accepts a String
encoding accepts a String
Return Value an Integer

Buffer.writeShort

Writes short to this buffer
overload 1:
Buffer:writeShort(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.writeLong

Writes long to this buffer
overload 1:
Buffer:writeLong(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.writeDouble

Writes double to this buffer
overload 1:
Buffer:writeDouble(val)
Method Property Fluent Description Representation
val accepts a Number
Return Value nil

Buffer.readDouble

Reads double from this buffer
overload 1:
Buffer:readDouble()
Method Property Fluent Description Representation
Return Value a Number

Buffer.getPosition

Returns current position of this buffer
overload 1:
Buffer:getPosition()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.readUShort

Reads unsigned short from this buffer
overload 1:
Buffer:readUShort()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.isClosed

Checks, is this buffer closed or not
overload 1:
Buffer:isClosed()
Method Property Fluent Description Representation
Return Value a Boolean

Buffer.getMaxCapacity

Returns max capacity this buffer can have
overload 1:
Buffer:getMaxCapacity()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.writeByteArray

Writes raw bytes of string to this buffer and returns amount of bytes written.
overload 1:
Buffer:writeByteArray(array)
Method Property Fluent Description Representation
array accepts a String
Return Value an Integer

Buffer.setPosition

Sets current position of this buffer
overload 1:
Buffer:setPosition(position)
Method Property Fluent Description Representation
position accepts an Integer
Return Value nil

Buffer.readByteArray

Reads bytes from this buffer to a string byte array. Length is amount of bytes to read, default length is 1024
overload 1:
Buffer:readByteArray()
Method Property Fluent Description Representation
Return Value a String
overload 2:
Buffer:readByteArray(length)
Method Property Fluent Description Representation
length accepts an Integer
Return Value a String

Buffer.readBase64

Reads bytes from this buffer to a Base64 string. Length is amount of bytes to read, default length is 1024
overload 1:
Buffer:readBase64()
Method Property Fluent Description Representation
Return Value a String
overload 2:
Buffer:readBase64(length)
Method Property Fluent Description Representation
length accepts an Integer
Return Value a String

Buffer.writeBase64

Writes bytes of Base64 string to this buffer and returns amount of bytes written.
overload 1:
Buffer:writeBase64(base64)
Method Property Fluent Description Representation
base64 accepts a String
Return Value an Integer

Buffer.writeUShort

Writes unsigned short to this buffer
overload 1:
Buffer:writeUShort(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.writeUShortLE

Writes little endian unsigned short to this buffer
overload 1:
Buffer:writeUShortLE(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.readUShortLE

Reads little endian unsigned short from this buffer
overload 1:
Buffer:readUShortLE()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.readFromStream

Reads data from provided input stream and writes it to buffer, returns amount of bytes wrote
overload 1:
Buffer:readFromStream(stream, amount)
Method Property Fluent Description Representation
stream accepts an InputStream
amount accepts an Integer
Return Value an Integer

Buffer.writeToStream

Writes data from this buffer to provided output stream
overload 1:
Buffer:writeToStream(stream, amount)
Method Property Fluent Description Representation
stream accepts an OutputStream
amount accepts an Integer
Return Value an Integer

Buffer.writeLongLE

Writes little endian long to this buffer
overload 1:
Buffer:writeLongLE(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.readFloatLE

Reads little endian float from this buffer
overload 1:
Buffer:readFloatLE()
Method Property Fluent Description Representation
Return Value a Number

Buffer.writeShortLE

Writes little endian short to this buffer
overload 1:
Buffer:writeShortLE(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.readIntLE

Reads little endian integer from this buffer
overload 1:
Buffer:readIntLE()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.writeFloatLE

Writes little endian float to this buffer
overload 1:
Buffer:writeFloatLE(val)
Method Property Fluent Description Representation
val accepts a Number
Return Value nil

Buffer.readDoubleLE

Reads little endian double from this buffer
overload 1:
Buffer:readDoubleLE()
Method Property Fluent Description Representation
Return Value a Number

Buffer.readShortLE

Reads little endian short from this buffer
overload 1:
Buffer:readShortLE()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.readLongLE

Reads little endian long from this buffer
overload 1:
Buffer:readLongLE()
Method Property Fluent Description Representation
Return Value an Integer

Buffer.writeIntLE

Writes little endian integer to this buffer
overload 1:
Buffer:writeIntLE(val)
Method Property Fluent Description Representation
val accepts an Integer
Return Value nil

Buffer.writeDoubleLE

Writes little endian double to this buffer
overload 1:
Buffer:writeDoubleLE(val)
Method Property Fluent Description Representation
val accepts a Number
Return Value nil
a a