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.

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

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

staticofHex(s:String):Bytes

Converts the given hexadecimal String to Bytes. s must be a string of even length consisting only of hexadecimal digits. For example: "0FDA14058916052309".

staticofData(b:BytesData):Bytes

Available with clay native, gif plugin, unity

Returns the Bytes representation of the given BytesData.

Variables

read onlylength:Int

Methods

inlineget(pos:Int):Int

Returns the byte at index pos.

inlineset(pos:Int, v:Int):Void

Stores the given byte v at the given position pos.

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

Available on clay

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

toString():String

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

@:has_untypedinlinegetData():BytesData

Returns the bytes of this instance as BytesData.

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

Available with gif plugin, tilemap plugin

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.

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

Available with tilemap plugin

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