Skip to content

Documentation

HOUIS Mathis edited this page Dec 19, 2021 · 5 revisions

Class BufferWS


Reading


BufferWS

new BufferWS(buffer)
Parameter Type Description
buffer Buffer or Uint8Array

Constructs a new BufferWS.


BufferWS#readByte

BufferWS.readByte()
Parameter Type Description
@return number

Reads a byte.


BufferWS#readBool

BufferWS.readBool()
Parameter Type Description
@return boolean

Reads a boolean.


BufferWS#readShort

BufferWS.readShort()
Parameter Type Description
@return number

Reads a short.


BufferWS#readInt

BufferWS.readInt()
Parameter Type Description
@return number

Reads an integer.


BufferWS#readDouble

BufferWS.readDouble()
Parameter Type Description
@return number

Reads a double.


BufferWS#readString

BufferWS.readString()
Parameter Type Description
@return string

Reads a string.


Writing


BufferWS#writeByte

BufferWS.writeByte(value)
Parameter Type Description
value number
@return BufferWS this

Writes a byte.


BufferWS#writeBool

BufferWS.writeBool(value)
Parameter Type Description
value boolean
@return BufferWS this

Writes a boolean.


BufferWS#writeShort

BufferWS.writeShort(value)
Parameter Type Description
value number
@return BufferWS this

Writes a short.


BufferWS#writeInt

BufferWS.writeInt(value)
Parameter Type Description
value number
@return BufferWS this

Writes an integer.


BufferWS#writeDouble

BufferWS.writeDouble(value)
Parameter Type Description
value number
@return BufferWS this

Writes a double.


BufferWS#writeString

BufferWS.writeString(value)
Parameter Type Description
value string
@return BufferWS this

Writes a string.


Other


BufferWS#getByteArray

BufferWS.getByteArray()
Parameter Type Description
@return Uint8Array

Return the bytearray of the BufferWS.


BufferWS#getBuffer

BufferWS.getBuffer()
Parameter Type Description
@return Buffer

Return the buffer.


BufferWS#flip

BufferWS.flip()
Parameter Type Description
@return BufferWS this

Make the buffer ready for a new sequence of write or relative read operations.