Kodi's file class.
More...
Kodi's file class.
Class: xbmcvfs.File(filepath, [mode])
- Parameters
-
filepath | string Selected file path |
mode | [opt] string Additional mode options (if no mode is supplied, the default is Open for Read).
Mode | Description |
w | Open for write |
|
Example:
..
f = xbmcvfs.File(file, 'w')
..
◆ close()
XBMCAddon::xbmcvfs::File::close |
( |
| ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> close() </big></font></span></code></h4> \endhtmlonly
Close opened file.
Example:
..
f = xbmcvfs.File(file)
f.close()
..
◆ File()
XBMCAddon::xbmcvfs::File::File |
( |
const String & |
filepath, |
|
|
const char * |
mode = NULL |
|
) |
| |
|
inline |
◆ getFile()
const XFILE::CFile * XBMCAddon::xbmcvfs::File::getFile |
( |
| ) |
const |
|
inline |
◆ read()
XBMCAddon::xbmcvfs::File::read |
( |
|
... | ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> read([bytes]) </big></font></span></code></h4> \endhtmlonly
Read file parts as string.
- Parameters
-
bytes | [opt] How many bytes to read - if not set it will read the whole file |
- Returns
- string
Example:
..
f = xbmcvfs.File(file)
b = f.read()
f.close()
..
◆ readBytes()
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> readBytes(numbytes) </big></font></span></code></h4> \endhtmlonly
Read bytes from file.
- Parameters
-
numbytes | How many bytes to read [opt]- if not set it will read the whole file |
- Returns
- bytearray
Example:
..
f = xbmcvfs.File(file)
b = f.read()
f.close()
..
◆ seek()
XBMCAddon::xbmcvfs::File::seek |
( |
|
... | ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> seek(seekBytes, iWhence) </big></font></span></code></h4> \endhtmlonly
Seek to position in file.
- Parameters
-
seekBytes | position in the file |
iWhence | where in a file to seek from[0 beginning, 1 current , 2 end position] |
Example:
..
f = xbmcvfs.File(file)
result = f.seek(8129, 0)
f.close()
..
◆ size()
XBMCAddon::xbmcvfs::File::size |
( |
| ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> size() </big></font></span></code></h4> \endhtmlonly
Get the file size.
- Returns
- The file size
Example:
..
f = xbmcvfs.File(file)
s = f.size()
f.close()
..
◆ write()
bool XBMCAddon::xbmcvfs::File::write |
( |
|
... | ) |
|
@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> write(buffer) </big></font></span></code></h4> \endhtmlonly
To write given data in file.
- Parameters
-
buffer | Buffer to write to file |
- Returns
- True on success.
Example:
..
f = xbmcvfs.File(file, 'w')
result = f.write(buffer)
f.close()
..
◆ ~File()
XBMCAddon::xbmcvfs::File::~File |
( |
| ) |
|
|
inlineoverride |