class BinaryFile
Provides binary file input and output functions.
Constructors
BinaryFile () | Constructs a new binary file object. |
Methods
int Close () | Closes the file. |
Flush () | Writes the contents of the output buffer to disk. |
int Open (const Path, const int) | Opens a binary file with the specified mode and at the given path. |
int ReadByte () | Reads a byte from the file and returns it as an unsigned integer. |
int[] ReadBytes (const int) | Reads the specified number of bytes from the file and returns them as an array of unsigned integers. |
int ReadInt () | Reads a 32-bit integer from the file. |
int ReadShort () | Reads a 16-bit integer from the file and returns it as an unsigned integer. |
WriteByte (const int) | Writes a byte into the file. |
WriteBytes (const int[]) | Writes all integers from the specified array as unsigned bytes to the file. |
WriteInt (const int) | Writes a 32-bit integer into the file. |
WriteShort (const int) | Writes a 16-bit integer into the file. |
Properties
int EndOfFile () | Returns true if the end of the file has been reached. |
int Length () | Returns the length of the file in bytes. |
int Locator () | Retrieves the file locator, which is the current read / write position in the file. |
Locator (const int) | Sets the file locator to the specified byte address in the file. |
Reference
method BinaryFile () |
Constructs a new binary file object. |
method int Close () |
Closes the file. |
method Flush () |
Writes the contents of the output buffer to disk. |
method int Open (const Path path, const int mode) |
Opens a binary file with the specified mode and at the given path. Mode constants are BinaryFile::kRead, BinaryFile::kWrite, BinaryFile::kAppend, BinaryFile::kReadWriteExisting, BinaryFile::kReadWriteEmpty, BinaryFile::kReadWriteAppend. |
method int ReadByte () |
Reads a byte from the file and returns it as an unsigned integer. |
method int[] ReadBytes (const int length) |
Reads the specified number of bytes from the file and returns them as an array of unsigned integers. |
method int ReadInt () |
Reads a 32-bit integer from the file. |
method int ReadShort () |
Reads a 16-bit integer from the file and returns it as an unsigned integer. |
method WriteByte (const int value) |
Writes a byte into the file. |
method WriteBytes (const int[] values) |
Writes all integers from the specified array as unsigned bytes to the file. This will fail with multi-dimensional arrays. |
method WriteInt (const int value) |
Writes a 32-bit integer into the file. |
method WriteShort (const int value) |
Writes a 16-bit integer into the file. |
accessor int EndOfFile () |
Returns true if the end of the file has been reached. |
accessor int Length () |
Returns the length of the file in bytes. Calling this may alter the current file locator. |
accessor int Locator () |
Retrieves the file locator, which is the current read / write position in the file. |
accessor Locator (const int position) |
Sets the file locator to the specified byte address in the file. |