Write 'maxbytes' from the buffer from a file, returning a new
buffer with the 'location' pointer moved along
Set the byte at position 'loc' to 'val'.
Does nothing if the location is out of bounds of the buffer, or the string
is too long for the location
Set the int at position 'loc' to 'val'.
Uses 4 bytes (assumes up to 32 bit Int).
Does nothing if the location is outside the bounds of the buffer
Set the double at position 'loc' to 'val'.
Uses 8 bytes (assumes 64 bit double).
Does nothing if the location is outside the bounds of the buffer
Set the byte at position 'loc' to 'val'.
Does nothing if the location is outside the bounds of the buffer
Create a new buffer, copying the contents of the old buffer to the new.
Returns 'Nothing' if resizing fails
Reset the 'next location' pointer of the buffer to 0.
The 'next location' pointer gives the location for the next file read/write
so resetting this means you can write it again
Read 'maxbytes' into the buffer from a file, returning a new
buffer with the 'locaton' pointer moved along
Return the space available in the buffer
Create a new buffer 'size' bytes long. Returns 'Nothing' if allocation
fails
Return the string at the given location in the buffer, with the given
length. Returns "" if out of bounds.
Return the value at the given location in the buffer, assuming 4
bytes to store the Int.
Returns 0 if out of bounds.
Return the value at the given location in the buffer, assuming 8
bytes to store the Double.
Returns 0 if out of bounds.
Return the value at the given location in the buffer.
Returns 0 if out of bounds.
Copy data from 'src' to 'dest'. Reads 'len' bytes starting at position
'start' in 'src', and writes them starting at position 'loc' in 'dest'.
Does nothing if a location is out of bounds, or there is not enough room
Return the contents of the buffer as a list
Raw bytes, as a pointer to a block of memory
Cached size of block
Next location to read/write (e.g. when reading from file)
A buffer is a pointer to a sized, unstructured, mutable chunk of memory.
There are primitive operations for getting and setting bytes, ints (32 bit)
and strings at a location in the buffer. These operations silently fail
if the location is out of bounds, so bounds checking should be done in
advance.
Raw bytes, as a pointer to a block of memory
Cached size of block
Next location to read/write (e.g. when reading from file)
Raw bytes, as a pointer to a block of memory
Cached size of block
Next location to read/write (e.g. when reading from file)