bufferΒΆ

meth (Source: address):buffer: buffer

Allocates a new buffer with the same size and initial contents as Source.

buffer("Hello world") :> <11:48656C6C6F20776F726C64>
type buffer < address

A buffer represents a writable bounded section of memory.

meth (Buffer: buffer):put(Value: address): buffer

Puts the bytes of Value in Buffer.

buffer(10):put("Hello\0\0\0\0\0")
:> <10:48656C6C6F0000000000>
meth (Buffer: buffer):put16(Value: integer): buffer

Puts Value in Buffer as an 16-bit signed value. Uses the platform byte order.

buffer(2):put16(12345) :> <2:3930>
meth (Buffer: buffer):put16(Value: integer, Order: byte::order): buffer

Puts Value in Buffer as an 16-bit signed value. Uses Order byte order.

buffer(2):put16(12345, address::LE) :> <2:3930>
buffer(2):put16(12345, address::BE) :> <2:3039>
meth (Buffer: buffer):put32(Value: integer): buffer

Puts Value in Buffer as an 32-bit signed value. Uses the platform byte order.

buffer(4):put32(12345) :> <4:39300000>
meth (Buffer: buffer):put32(Value: integer, Order: byte::order): buffer

Puts Value in Buffer as an 32-bit signed value. Uses Order byte order.

buffer(4):put32(12345, address::LE) :> <4:39300000>
buffer(4):put32(12345, address::BE) :> <4:00003039>
meth (Buffer: buffer):put64(Value: integer): buffer

Puts Value in Buffer as an 64-bit signed value. Uses the platform byte order.

buffer(8):put64(12345) :> <8:3930000000000000>
meth (Buffer: buffer):put64(Value: integer, Order: byte::order): buffer

Puts Value in Buffer as an 64-bit signed value. Uses Order byte order.

buffer(8):put64(12345, address::LE)
:> <8:3930000000000000>
buffer(8):put64(12345, address::BE)
:> <8:0000000000003039>
meth (Buffer: buffer):put8(Value: integer): buffer

Puts Value in Buffer as an 8-bit signed value.

buffer(1):put8(64) :> <1:40>
meth (Buffer: buffer):putf32(Value: real): buffer

Puts Value in Buffer as a 32-bit floating point value. Uses the platform byte order.

buffer(4):putf32(1.23456789) :> <4:52069E3F>
meth (Buffer: buffer):putf32(Value: real, Order: byte::order): buffer

Puts Value in Buffer as a 32-bit floating point value. Uses little endian byte order.

buffer(4):putf32(1.23456789, address::LE) :> <4:52069E3F>
buffer(4):putf32(1.23456789, address::BE) :> <4:3F9E0652>
meth (Buffer: buffer):putf64(Value: real): buffer

Puts Value in Buffer as a 64-bit floating point value. Uses the platform byte order.

buffer(8):putf64(1.23456789) :> <8:1BDE8342CAC0F33F>
meth (Buffer: buffer):putf64(Value: real, Order: byte::order): buffer

Puts Value in Buffer as a 64-bit floating point value. Uses little endian byte order.

buffer(8):putf64(1.23456789, address::LE)
:> <8:1BDE8342CAC0F33F>
buffer(8):putf64(1.23456789, address::BE)
:> <8:3FF3C0CA4283DE1B>
meth (Buffer: buffer):putu16(Value: integer): buffer

Puts Value in Buffer as an 16-bit unsigned value. Uses the platform byte order.

buffer(2):putu16(12345) :> <2:3930>
meth (Buffer: buffer):putu16(Value: integer, Order: byte::order): buffer

Puts Value in Buffer as an 16-bit unsigned value. Uses Order byte order.

buffer(2):putu16(12345, address::LE) :> <2:3930>
buffer(2):putu16(12345, address::BE) :> <2:3039>
meth (Buffer: buffer):putu32(Value: integer): buffer

Puts Value in Buffer as an 32-bit unsigned value. Uses the platform byte order.

buffer(4):putu32(12345) :> <4:39300000>
meth (Buffer: buffer):putu32(Value: integer, Order: byte::order): buffer

Puts Value in Buffer as an 32-bit unsigned value. Uses Order byte order.

buffer(4):putu32(12345, address::LE) :> <4:39300000>
buffer(4):putu32(12345, address::BE) :> <4:00003039>
meth (Buffer: buffer):putu64(Value: integer): buffer

Puts Value in Buffer as an 64-bit unsigned value. Uses the platform byte order.

buffer(8):putu64(12345) :> <8:3930000000000000>
meth (Buffer: buffer):putu64(Value: integer, Order: byte::order): buffer

Puts Value in Buffer as an 64-bit unsigned value. Uses Order byte order.

buffer(8):putu64(12345, address::LE)
:> <8:3930000000000000>
buffer(8):putu64(12345, address::BE)
:> <8:0000000000003039>
meth (Buffer: buffer):putu8(Value: integer): buffer

Puts Value in Buffer as an 8-bit unsigned value.

buffer(1):put8(64) :> <1:40>
meth (Length: integer):buffer: buffer

Allocates a new buffer with Length bytes.

buffer(16) :> <16:802130F8487F00004368696C6429207B>