MemoryFile

This is basically an owned buffer, with capacity, optionally borrowed. The original things being that it can both be used for reading and writing.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

ensureCapacity
void ensureCapacity(size_t numBytes)
Undocumented in source. Be warned that the author may not have intended to support it.
initEmpty
void initEmpty()

Initialize empty buffer for writing. Must be a T.init object.

initFromExistingSlice
void initFromExistingSlice(const(ubyte)[] arr)

Initialize buffer as reading a slice. Must be a T.init object.

releaseData
ubyte[] releaseData()

Return internal data pointer (allocated with malloc/free) stream doesn't own it anymore, the caller does instead. Can only be called if that buffer is owned is the first place.

Variables

bytes
size_t bytes;

Length of buffer.

capacity
size_t capacity;

Size of the underlying allocation, meaningful if owned.

data
ubyte* data;

Pointer to data (owned or borrowed). if owned, the buffer is guaranteed to be allocated with malloc/free/realloc.

offset
size_t offset;

Current pointer in the buffer.

owned
bool owned;

If the memory is owned by MemoryFile, or borrowed.

readOnly
bool readOnly;

If can only read from buffer.

Meta