FileStream

System stream specialized into reading and writing files, including huge ones (up to 2^64 bytes). Several constructors are avalaible with predefined options.

Constructors

this
this(const(char)[] aFilename, int creationMode = cmAlways)

Constructs the stream and call openPermissive().

this
this(const(char)[] aFilename, int access, int share, int creationMode)

Constructs the stream and call open().

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

closeFile
void closeFile()

Closes the file and flushes any pending changes to the disk. After the call, handle is not valid anymore.

filename
string filename()

Exposes the filename.

open
bool open(const(char)[] aFilename, int access, int share, int creationMode)

The fully parametric open version. Do not throw. Under POSIX, access can be already OR-ed with other, unrelated flags (e.g: O_NOFOLLOW or O_NONBLOCK).

openPermissive
bool openPermissive(const(char)[] aFilename, int creationMode = cmAlways)

Opens a shared file. By default the file is always created or opened.

openStrict
bool openStrict(const(char)[] aFilename, int creationMode = cmAlways)

Opens a file for the current user. By default the file is always created or opened.

Inherited Members

From SystemStream

read
size_t read(Ptr buffer, size_t count)

see the Stream interface.

write
size_t write(const Ptr buffer, size_t count)

see the Stream interface.

seek
long seek(long offset, SeekMode mode)
int seek(int offset, SeekMode mode)

see the Stream interface.

size
long size()
void size(long value)
void size(int value)

see the Stream interface.

position
long position()
void position(long value)
void position(int value)

see the Stream interface.

handle
const(StreamHandle) handle()

Exposes the handle for additional system stream operations.

clear
void clear()

see the Stream interface.

saveToStream
void saveToStream(Stream stream)

see the Stream interface.

loadFromStream
void loadFromStream(Stream stream)

see the Stream interface.

Meta