Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Creatable class for virtual file server control
To perform file read/write with Kodi's filesystem parts.
More...
Classes | |
class | kodi::vfs::CFile |
Functions | |
kodi::vfs::CFile::CFile ()=default | |
Construct a new, unopened file. | |
virtual | kodi::vfs::CFile::~CFile () |
Close() is called from the destructor, so explicitly closing the file isn't required. | |
bool | kodi::vfs::CFile::OpenFile (const std::string &filename, unsigned int flags=0) |
Open the file with filename via Kodi's CFile. Needs to be closed by calling Close() when done. | |
bool | kodi::vfs::CFile::OpenFileForWrite (const std::string &filename, bool overwrite=false) |
Open the file with filename via Kodi's CFile in write mode. Needs to be closed by calling Close() when done. | |
bool | kodi::vfs::CFile::IsOpen () const |
Check file is opened. | |
void | kodi::vfs::CFile::Close () |
Close an open file. | |
bool | kodi::vfs::CFile::CURLCreate (const std::string &url) |
Create a Curl representation. | |
bool | kodi::vfs::CFile::CURLAddOption (CURLOptiontype type, const std::string &name, const std::string &value) |
Add options to the curl file created with CURLCreate. | |
bool | kodi::vfs::CFile::CURLOpen (unsigned int flags=0) |
Open the curl file created with CURLCreate. | |
ssize_t | kodi::vfs::CFile::Read (void *ptr, size_t size) |
Read from an open file. | |
bool | kodi::vfs::CFile::ReadLine (std::string &line) |
Read a string from an open file. | |
ssize_t | kodi::vfs::CFile::Write (const void *ptr, size_t size) |
Write to a file opened in write mode. | |
void | kodi::vfs::CFile::Flush () |
Flush buffered data. | |
int64_t | kodi::vfs::CFile::Seek (int64_t position, int whence=SEEK_SET) |
Set the file's current position. | |
int | kodi::vfs::CFile::Truncate (int64_t size) |
Truncate a file to the requested size. | |
int64_t | kodi::vfs::CFile::GetPosition () const |
The current offset in an open file. | |
int64_t | kodi::vfs::CFile::GetLength () const |
Get the file size of an open file. | |
bool | kodi::vfs::CFile::AtEnd () const |
Checks the file access is on end position. | |
int | kodi::vfs::CFile::GetChunkSize () const |
Get the chunk size for an open file. | |
bool | kodi::vfs::CFile::IoControlGetSeekPossible () const |
To check seek possible on current stream by file. | |
bool | kodi::vfs::CFile::IoControlGetCacheStatus (CacheStatus &status) const |
To check a running stream on file for state of his cache. | |
bool | kodi::vfs::CFile::IoControlSetCacheRate (uint32_t rate) |
Unsigned int with speed limit for caching in bytes per second. | |
bool | kodi::vfs::CFile::IoControlSetRetry (bool retry) |
Enable/disable retry within the protocol handler (if supported). | |
const std::string | kodi::vfs::CFile::GetPropertyValue (FilePropertyTypes type, const std::string &name) const |
Retrieve a file property. | |
const std::vector< std::string > | kodi::vfs::CFile::GetPropertyValues (FilePropertyTypes type, const std::string &name) const |
Retrieve file property values. | |
double | kodi::vfs::CFile::GetFileDownloadSpeed () const |
Get the current download speed of file if loaded from web. | |
Creatable class for virtual file server control
To perform file read/write with Kodi's filesystem parts.
CFile is the class used for handling Files in Kodi. This class can be used for creating, reading, writing and modifying files. It directly provides unbuffered, binary disk input/output services
It has the header #include <kodi/Filesystem.h> be included to enjoy it.
Example:
|
inline |
Checks the file access is on end position.
|
default |
Construct a new, unopened file.
|
inline |
Close an open file.
|
inline |
Add options to the curl file created with CURLCreate.
[in] | type | Option type to set, see CURLOptiontype |
[in] | name | Name of the option |
[in] | value | Value of the option |
|
inline |
Create a Curl representation.
[in] | url | The URL of the Type. |
Open the curl file created with CURLCreate.
[in] | flags | [opt] The flags to pass, see OpenFileFlags |
|
inline |
Flush buffered data.
If the given stream was open for writing (or if it was open for updating and the last i/o operation was an output operation) any unwritten data in its output buffer is written to the file.
The stream remains open after this call.
When a file is closed, either because of a call to close or because the class is destructed, all the buffers associated with it are automatically flushed.
|
inline |
Get the chunk size for an open file.
|
inline |
Get the current download speed of file if loaded from web.
|
inline |
Get the file size of an open file.
|
inline |
The current offset in an open file.
|
inline |
Retrieve a file property.
[in] | type | The type of the file property to retrieve the value for |
[in] | name | The name of a named property value (e.g. Header) |
|
inline |
Retrieve file property values.
[in] | type | The type of the file property values to retrieve the value for |
[in] | name | The name of the named property (e.g. Header) |
|
inline |
To check a running stream on file for state of his cache.
[in] | status | Information about current cache status |
The following table contains values that can be set with class CacheStatus :
Name | Type | Set call | Get call |
---|---|---|---|
Number of bytes cached | uint64_t | SetForward | GetForward |
Maximum number of bytes per second | uint32_t | SetMaxRate | GetMaxRate |
Average read rate from source file | uint32_t | SetCurrentRate | GetCurrentRate |
Cache low speed rate detected | uint32_t | SetLowRate | GetLowRate |
|
inline |
To check seek possible on current stream by file.
|
inline |
Unsigned int with speed limit for caching in bytes per second.
[in] | rate | Cache rate size to use |
Enable/disable retry within the protocol handler (if supported).
[in] | retry | To set the retry, true for use, false for not |
|
inline |
Check file is opened.
Open the file with filename via Kodi's CFile. Needs to be closed by calling Close() when done.
[in] | filename | The filename to open. |
[in] | flags | [opt] The flags to pass, see OpenFileFlags |
Read from an open file.
[in] | ptr | The buffer to store the data in. |
[in] | size | The size of the buffer. |
|
inline |
Read a string from an open file.
[out] | line | The buffer to store the data in. |
Example:
Set the file's current position.
The whence argument is optional and defaults to SEEK_SET (0)
[in] | position | the position that you want to seek to | ||||||||||||
[in] | whence | [optional] offset relative to You can set the value of whence to one of three things:
|
Truncate a file to the requested size.
[in] | size | The new max size. |
Write to a file opened in write mode.
[in] | ptr | Pointer to the data to write, converted to a const void* . |
[in] | size | Size of the data to write. |
|
inlinevirtual |
Close()
is called from the destructor, so explicitly closing the file isn't required.