Skip to content

PackageItemFile

A File implementation that provides access to an item in an Amplitude package file.

Inherits the following classes: SparkyStudios::Audio::Amplitude::File

Public Functions

Type Name
virtual void Close () override
Closes the file an releases allocated resources.
virtual bool Eof () override const
Checks if the read cursor is at the end of the file.
AmSize GetBasePosition () const
Get the base position of this file item in the entire package file.
virtual AmOsString GetPath () override const
Gets the path to the file in the loaded FileSystem .
virtual AmVoidPtr GetPtr () override const
Gets the pointer to the internal file handle.
virtual bool IsValid () override const
Checks if the file is valid.
virtual AmSize Length () override const
Gets the size of the file in bytes.
PackageItemFile (const PackageFileItemDescription * item, std::shared_ptr< File > packageFile, AmSize headerSize)
Constructs a new PackageItemFile instance.
virtual AmSize Position () override const
Gets the current position of the read/write cursor.
virtual AmSize Read (AmUInt8Buffer dst, AmSize bytes) override const
Reads data from the file.
virtual void Seek (AmInt64 offset, eFileSeekOrigin origin) override
Seeks the read/write to the specified offset, starting at the given origin.
virtual AmSize Write (AmConstUInt8Buffer src, AmSize bytes) override
~PackageItemFile () override
Destroys this instance.

Public Functions inherited from SparkyStudios::Audio::Amplitude::File

See SparkyStudios::Audio::Amplitude::File

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

Close

Closes the file an releases allocated resources.

virtual void Amplitude::PackageItemFile::Close () override

Implements SparkyStudios::Audio::Amplitude::File::Close

Eof

Checks if the read cursor is at the end of the file.

virtual bool Amplitude::PackageItemFile::Eof () override const

Returns:

true if the read cursor is at the end of the file, false otherwise.

Implements SparkyStudios::Audio::Amplitude::File::Eof

GetBasePosition

Get the base position of this file item in the entire package file.

AmSize Amplitude::PackageItemFile::GetBasePosition () const
GetPath

Gets the path to the file in the loaded FileSystem .

virtual AmOsString Amplitude::PackageItemFile::GetPath () override const

Returns:

The path to the file.

Implements SparkyStudios::Audio::Amplitude::File::GetPath

GetPtr

Gets the pointer to the internal file handle.

virtual AmVoidPtr Amplitude::PackageItemFile::GetPtr () override const

Returns:

The internal file handle. This depends on the implementation.

Implements SparkyStudios::Audio::Amplitude::File::GetPtr

IsValid

Checks if the file is valid.

virtual bool Amplitude::PackageItemFile::IsValid () override const

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.

Implements SparkyStudios::Audio::Amplitude::File::IsValid

Length

Gets the size of the file in bytes.

virtual AmSize Amplitude::PackageItemFile::Length () override const

Returns:

The size of the file in bytes.

Implements SparkyStudios::Audio::Amplitude::File::Length

PackageItemFile

Constructs a new PackageItemFile instance.

Amplitude::PackageItemFile::PackageItemFile (
    const PackageFileItemDescription * item,
    std::shared_ptr< File > packageFile,
    AmSize headerSize
) 

Parameters:

  • item The description of the package item.
  • packageFile The package file containing this item.
  • headerSize The size of the package file header.
Position

Gets the current position of the read/write cursor.

virtual AmSize Amplitude::PackageItemFile::Position () override const

Returns:

The actual position of the read/write cursor.

Implements SparkyStudios::Audio::Amplitude::File::Position

Read

Reads data from the file.

virtual AmSize Amplitude::PackageItemFile::Read (
    AmUInt8Buffer dst,
    AmSize bytes
) override const

Parameters:

  • dst The destination buffer of the read data.
  • bytes The 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.

Implements SparkyStudios::Audio::Amplitude::File::Read

Seek

Seeks the read/write to the specified offset, starting at the given origin.

virtual void Amplitude::PackageItemFile::Seek (
    AmInt64 offset,
    eFileSeekOrigin origin
) override

Parameters:

  • offset The offset in bytes from the beginning of the file.
  • origin The origin from which to begin seeking.

Implements SparkyStudios::Audio::Amplitude::File::Seek

Write
virtual AmSize Amplitude::PackageItemFile::Write (
    AmConstUInt8Buffer src,
    AmSize bytes
) override

Note:

Writing is disabled for packages item files.

Implements SparkyStudios::Audio::Amplitude::File::Write

~PackageItemFile

Destroys this instance.

Amplitude::PackageItemFile::~PackageItemFile () override

The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/IO/PackageItemFile.h