VFile

Implements the virtual file.

Constructors

this
this(T[] target, string name)

Creates a virtual file out from an array.

this
this(void* ptr, size_t length, string name)

Creates a virtual file out from a pointer and a length indicator.

Members

Enums

Orientation
enum Orientation
Undocumented in source.

Functions

byLine
auto byLine(Flag!"keepTerm" keepTerm, Term term)

Return an input range to read the data stream by line.

close
void close()

Closes the datastream.

rawRead
T[] rawRead(T[] buffer)

Copies the data into the buffer and moves the file forward the length of the buffer. Throws exception if EOF reached.

rawWrite
void rawWrite(T[] buffer)

Writes data into the datastream. If the stream is shorter, then it'll be extended.

read
T read()

Reads a single element from the stream. Throws Exception if EOF reached. Important: Does not provide any complex serialization method, so structs must avoid heap managed fields like dynamic arrays. They should implement a custom serializer.

write
T write(T buffer)

Writes a single element to the stream. Throws Exception if EOF reached. Important: Does not provide any complex serialization method, so structs must avoid heap managed fields like dynamic arrays. They should implement a custom serializer.

Properties

isOpen
bool isOpen [@property getter]

Indicates if the virtual file is opened. If the datastream isn't null, it must be open.

seek
void seek(long offset, int origin)

Jumps to the given location.

size
size_t size [@property getter]

Returns the size of the datastream.

tell
size_t tell [@property getter]

Returns the current position.

Meta