FileStream.Mode

Describes how the file should be opened.

This will also determine the capabilities (Stream.Can) of the stream.

Values

ValueMeaning
Open1 << 0

Opens the only if it exists.

Create1 << 1

Creates the file if it doesn't exist, and then acts the same as Mode.Open.

Read1 << 2

Supports reading.

Write1 << 3

Supports writing.

Binary1 << 4

Opens the file in binary mode.

Truncate1 << 5

Sets the file's size to 0 upon opening. Does not imply Mode.Create

Combine with Mode.Create to always make sure to either create, or truncate a file, meaning it's always there and always empty.

ReadWriteRead | Write
OpenOrCreateOpen | Create
ReadOpenOpen | Read
ReadCreateCreate | Read
ReadOpenOrCreateOpenOrCreate | Read
WriteOpenOpen | Write
WriteCreateCreate | Write
WriteOpenOrCreateOpenOrCreate | Write
ReadWriteOpenOpen | Read | Write
ReadWriteCreateCreate | Read | Write
ReadWriteOpenOrCreateOpenOrCreate | Read | Write

Meta