ByteBuffer library

Provides functionality byte buffer object. This library is automatically initialized. It is used by other libraries as Serial, Http, Udp ...

This buffer can be created

var bb = new ByteBuffer(20);


ByteBuffer new ByteBuffer (size);

Number size = size of buffer in bytes


Write data to ByteBuffer

fillFromArray (data);

Array data - constains data as M2MScript array

Function fills buffer from Array. Buffer size cannot be resized.

fillFromString (data);

String data - constains data as M2MScript String

Function fills buffer from String. Buffer size cannot be resized.

Append data

append (data);

ByteBuffer data - contains data as ByteBuffer

Function appends data buffer to target buffer.

Put one byte

putByte (index, byte);

Number index - position 0 - n Number byte - value of byte

Function puts one byte to the buffer on index position.

Retrieve data from ByteBuffer

Number getByte (index);

Number index - position

Function reads one byte from index position.


Array toArray ();

Function returns M2MScript array with values from ByteBuffer.

String toString ();

Function returns String with values from ByteBuffer.


Number getSize ();

Function returns size of ByteBuffer.

setSize (size);

Number size - new size in bytes

Function resize ByteBuffer. All data will be lost.

results matching ""

    No results matching ""