Static methods

staticalloc(length:Int):Bytes

Returns a new Bytes instance with the given length. The values of the bytes are not initialized and may not be zero.

staticofData(b:BytesData):Bytes

Returns the Bytes representation of the given BytesData.

staticofString(s:String, ?encoding:Encoding):Bytes

Returns the Bytes representation of the given String, using the specified encoding (UTF-8 by default).

Variables

read onlylength:Int

Methods

blit(pos:Int, src:Bytes, srcpos:Int, len:Int):Void

Copies len bytes from src into this instance.

Parameters:

pos

Zero-based location in this instance at which to start writing bytes.

src

Source Bytes instance from which to copy bytes.

srcpos

Zero-based location at src from which bytes will be copied.

len

Number of bytes to be copied.

getFloat(pos:Int):Float

Returns the IEEE single-precision value at the given position pos (in little-endian encoding). Result is unspecified if pos is outside the bounds.

getString(pos:Int, len:Int, ?encoding:Encoding):String

Returns the len-bytes long string stored at the given position pos, interpreted with the given encoding (UTF-8 by default).

setFloat(pos:Int, v:Float):Void

Stores the given IEEE single-precision value v at the given position pos in little-endian encoding. Result is unspecified if writing outside of bounds.

sub(pos:Int, len:Int):Bytes

Returns a new Bytes instance that contains a copy of len bytes of this instance, starting at index pos.

toString():String

Returns a String representation of the bytes interpreted as UTF-8.