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.
staticfastGet(b:BytesData, pos:Int):Int
Reads the pos-th byte of the given b bytes, in the most efficient way
possible. Behavior when reading outside of the available data is
unspecified.
Constructor
Variables
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 |
|---|---|
src | Source |
srcpos | Zero-based location at |
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.
fill(pos:Int, len:Int, value:Int):Void
Sets len consecutive bytes starting from index pos of this instance
to value.
getDouble(pos:Int):Float
Returns the IEEE double-precision value at the given position pos (in
little-endian encoding). Result is unspecified if pos is outside the
bounds.
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.
getInt32(pos:Int):Int
Returns the 32-bit integer at the given position pos (in little-endian
encoding).
getInt64(pos:Int):Int64
Returns the 64-bit integer at the given position pos (in little-endian
encoding).
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).
getUInt16(pos:Int):Int
Returns the 16-bit unsigned integer at the given position pos (in
little-endian encoding).
setDouble(pos:Int, v:Float):Void
Stores the given IEEE double-precision value v at the given position
pos in little-endian encoding. Result is unspecified if writing outside
of bounds.
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.
setInt32(pos:Int, v:Int):Void
Stores the given 32-bit integer v at the given position pos (in
little-endian encoding).
setInt64(pos:Int, v:Int64):Void
Stores the given 64-bit integer v at the given position pos (in
little-endian encoding).
setUInt16(pos:Int, v:Int):Void
Stores the given 16-bit unsigned integer v at the given position pos
(in little-endian encoding).