File¶
Base class used to manage files in a FileSystem .
Inherited by the following classes: SparkyStudios::Audio::Amplitude::AssetManagerFile, SparkyStudios::Audio::Amplitude::DiskFile, SparkyStudios::Audio::Amplitude::MappedFile, SparkyStudios::Audio::Amplitude::MemoryFile, SparkyStudios::Audio::Amplitude::NSFile, SparkyStudios::Audio::Amplitude::PackageItemFile
Public Functions¶
| Type | Name |
|---|---|
| virtual void | Close () = 0 Closes the file an releases allocated resources. |
| virtual bool | Eof () const = 0 Checks if the read cursor is at the end of the file. |
| virtual AmOsString | GetPath () const = 0 Gets the path to the file in the loaded FileSystem . |
| virtual AmVoidPtr | GetPtr () const = 0 Gets the pointer to the internal file handle. |
| virtual bool | IsValid () const = 0 Checks if the file is valid. |
| virtual AmSize | Length () const = 0 Gets the size of the file in bytes. |
| virtual AmSize | Position () const = 0 Gets the current position of the read/write cursor. |
| virtual AmSize | Read (AmUInt8Buffer dst, AmSize bytes) const = 0 Reads data from the file. |
| AmUInt16 | Read16 () const Reads two bytes from the file in an AmUInt16 . |
| AmUInt32 | Read32 () const Reads four bytes from the file in an AmUInt32 . |
| AmUInt64 | Read64 () const Reads eight bytes from the file in an AmUInt64 . |
| AmUInt8 | Read8 () const Reads a single byte from the file in an AmUInt8 . |
| AmString | ReadString () const Reads a string from the file. |
| void | Seek (AmSize offset) Seeks the read/write to the specified offset. |
| virtual void | Seek (AmInt64 offset, eFileSeekOrigin origin) = 0 Seeks the read/write to the specified offset, starting at the given origin. |
| virtual AmSize | Write (AmConstUInt8Buffer src, AmSize bytes) = 0 Writes data to the file. |
| AmSize | Write16 (AmUInt16 value) Writes two bytes to the file from an AmUInt16 . |
| AmSize | Write32 (AmUInt32 value) Writes four bytes to the file from an AmUInt32 . |
| AmSize | Write64 (AmUInt64 value) Writes eight bytes to the file from an AmUInt64 . |
| AmSize | Write8 (AmUInt8 value) Writes a single byte to the file from an AmUInt8 . |
| AmSize | WriteString (const AmString & value) Writes a string to the file. |
| virtual | ~File () = default Default destructor. |
Public Functions Documentation¶
Eof
Checks if the read cursor is at the end of the file.
Returns:
true if the read cursor is at the end of the file, false otherwise.
GetPath
Gets the path to the file in the loaded FileSystem .
Returns:
The path to the file.
GetPtr
Gets the pointer to the internal file handle.
Returns:
The internal file handle. This depends on the implementation.
IsValid
Checks if the file is valid.
The validity of a file is determined by the underlying implementation. But this should primarily mean that the file exists AND has been opened.
Returns:
true if the file is valid, false otherwise.
Length
Gets the size of the file in bytes.
Returns:
The size of the file in bytes.
Position
Gets the current position of the read/write cursor.
Returns:
The actual position of the read/write cursor.
Read
Reads data from the file.
Parameters:
-
dstThe destination buffer of the read data. -
bytesThe number of bytes to read from the file. The destination buffer must be at least as large as the number of bytes to read.
Returns:
The number of bytes read from the file.
Read16
Reads two bytes from the file in an AmUInt16 .
Returns:
The read value.
Read32
Reads four bytes from the file in an AmUInt32 .
Returns:
The read value.
Read64
Reads eight bytes from the file in an AmUInt64 .
Returns:
The read value.
Read8
Reads a single byte from the file in an AmUInt8 .
Returns:
The read value.
ReadString
Reads a string from the file.
Returns:
The read value.
Seek[1/2]
Seeks the read/write to the specified offset.
Parameters:
-
offsetThe offset in bytes from the beginning of the file.
Seek[2/2]
Seeks the read/write to the specified offset, starting at the given origin.
Parameters:
-
offsetThe offset in bytes from the beginning of the file. -
originThe origin from which to begin seeking.
Write
Writes data to the file.
Parameters:
-
srcThe source buffer of the data to write. -
bytesThe number of bytes to write to the file. The source buffer must be at least as large as the number of bytes to write.
Returns:
The number of bytes written to the file.
Write16
Writes two bytes to the file from an AmUInt16 .
Parameters:
-
valueThe value to write.
Write32
Writes four bytes to the file from an AmUInt32 .
Parameters:
-
valueThe value to write.
Write64
Writes eight bytes to the file from an AmUInt64 .
Parameters:
-
valueThe value to write.
Write8
Writes a single byte to the file from an AmUInt8 .
Parameters:
-
valueThe value to write.
WriteString
Writes a string to the file.
Parameters:
-
valueThe value to write.
The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/IO/File.h