bytes.jamo (built in)

bytes: builds and reads binary data, like a file format. use "bytes.jamo"

A Bytes holds bytes in one buffer that doubles when it's full. Numbers go in and out little end first, the way Windows files and x86-64 store them. set_ changes bytes already added, which helps when a size or a place is only known later.

structBytes

struct Bytes
    buffer: int
    capacity: int
    used: int
end

funcnew_bytes

func new_bytes(): Bytes

funcload_bytes

func load_bytes(path: string): Bytes

The bytes of a file

funcBytes.room

func Bytes.room(extra: int)

funcbytes_fits

func bytes_fits(value: int, low: int, high: int, kind: string)

funcBytes.add_u8

func Bytes.add_u8(value: int)

A byte, from 0 to 255

funcBytes.add_u16

func Bytes.add_u16(value: int)

2 bytes, from 0 to 65535

funcBytes.add_u32

func Bytes.add_u32(value: int)

4 bytes, for anything from -2147483648 to 4294967295

funcBytes.add_u64

func Bytes.add_u64(value: int)

8 bytes: any int

funcBytes.add_text

func Bytes.add_text(text: string)

The text's bytes, with nothing added at the end

funcBytes.pad_to

func Bytes.pad_to(size: int)

Zero bytes until the length is a multiple of size, like 512 for a file section

funcBytes.length

func Bytes.length(): int

funcBytes.check_place

func Bytes.check_place(at: int, size: int)

funcBytes.get_u8

func Bytes.get_u8(at: int): int

funcBytes.get_u16

func Bytes.get_u16(at: int): int

funcBytes.get_u32

func Bytes.get_u32(at: int): int

4 bytes read as a number from 0 to 4294967295

funcBytes.get_u64

func Bytes.get_u64(at: int): int

funcBytes.set_u8

func Bytes.set_u8(at: int, value: int)

funcBytes.set_u16

func Bytes.set_u16(at: int, value: int)

funcBytes.set_u32

func Bytes.set_u32(at: int, value: int)

funcBytes.set_u64

func Bytes.set_u64(at: int, value: int)

funcBytes.text

func Bytes.text(): string

All the bytes as text, which can hold any bytes

funcBytes.save

func Bytes.save(path: string)