Static methods

@:has_untypedstaticofData(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.

compare(other:Bytes):Int

Returns 0 if the bytes of this instance and the bytes of other are identical.

Returns a negative value if the length of this instance is less than the length of other, or a positive value if the length of this instance is greater than the length of other.

In case of equal lengths, returns a negative value if the first different value in other is greater than the corresponding value in this instance; otherwise returns a positive value.

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).

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.

toHex():String

Returns a hexadecimal String representation of the bytes of this instance.

toString():String

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