// Encapsulate a pointer. Note - The pointer will not be free'ed
boolload(void*data,size_tsize);
// Load a file into memory using mmap. The data pointer will be protected as read-only until append() or expand() is called
boolload(conststd::string&path);
// Save the data to a file.
boolsave(conststd::string&path);
// Create a Block encapsulating a sub-region of this block. The caller is responsible to free the object.
Block*getSubBlock(intstart,intlength);
// Append data to the end of the block, increasing the size of the block and making it read-write.
voidappend(void*data,size_tsize);
// Append data to the end of the block, increasing the size of the block and making it read-write.
voidappend(Block&data);
// Append string to the end of the block, increasing the size of the block and making it read-write. The null terminating character is included
voidappend(conststd::string&s);
// Expand or shrink the data block, and switch it to read-write mode. Note - this may result in a mmap'ed file being copied to malloc'ed ram and then closed
voidexpand(size_tsize);
// Unload a file, releasing any mmap'ed file handles or malloc'ed ram that was in use
voidunload();
// Return a pointer to the start of the data block
void*getStart();
// Return a pointer to the one byte after the end of the data block
void*getEnd();
// Return the size of the data block. Use append() or expand() to make the data block larger
size_tgetSize()const;
// Get the contents as a string
std::stringgetString();
// Copy the entire data block to the destination pointer
voidcopy(void*dest);
// Copy a range of data to the destination pointer
voidcopy(void*dest,intstart,intcount);
// Lock the memory, forcing it to be loaded into a contiguous block of address space
voidlock();
// Unlock the memory, releasing the address space for use by other allocations