|
MP4v2
|
Public Member Functions | |
| File (const std::string &name="", Mode mode=MODE_UNDEFINED, FileProvider *provider=NULL) | |
| Constructor. More... | |
| ~File () | |
| Destructor. More... | |
| bool | open (const std::string &name="", Mode mode=MODE_UNDEFINED) |
| Open file. More... | |
| bool | close () |
| Closes file. More... | |
| bool | seek (Size pos) |
| Set current file position in bytes. More... | |
| bool | read (void *buffer, Size size, Size &nin) |
| Binary stream read. More... | |
| bool | write (const void *buffer, Size size, Size &nout) |
| Binary stream write. More... | |
| bool | truncate (Size size) |
| Truncate file to length in bytes. More... | |
| bool | getSize (Size &nout) |
| Get size of file in bytes. More... | |
| void | setName (const std::string &name) |
| void | setMode (Mode mode) |
Public Attributes | |
| const std::string & | name |
| read-only: file pathname or empty-string if not applicable | |
| const bool & | isOpen |
| read-only: true if file is open | |
| const Mode & | mode |
| read-only: file mode | |
| const Size & | size |
| read-only: file size | |
| const Size & | position |
| read-only: file position | |
Additional Inherited Members | |
Public Types inherited from mp4v2::platform::io::FileProvider | |
| enum | Mode { MODE_UNDEFINED, MODE_READ, MODE_MODIFY, MODE_CREATE } |
| file operation mode flags More... | |
| typedef int64_t | Size |
| type used to represent all file sizes and offsets | |
Static Public Member Functions inherited from mp4v2::platform::io::FileProvider | |
| static FileProvider & | standard () |
File implementation.
File objects model real filesystem files in a 1:1 releationship and always treated as binary; there are no translations of text content performed.
The interface represents all sizes with a signed 64-bit value, thus the limit to this interface is 63-bits of size, roughly 9.22 million TB.
|
explicit |
Constructor.
A new file object is constructed but not opened.
| name | filename of file object, or empty-string. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
| mode | bitmask specifying mode flags. See Mode for bit constants. |
| provider | a fileprovider instance. If NULL a standard file provider will be used otherwise the supplied provider must be new-allocated and will be delete'd via ~File(). |
| mp4v2::platform::io::File::~File | ( | ) |
Destructor.
File object is destroyed. If the file is opened it is closed prior to destruction.
|
virtual |
Closes file.
If the file has not been opened or is not considered the owner of a filehandle, no action is taken.
Implements mp4v2::platform::io::FileProvider.
|
virtual |
Get size of file in bytes.
| nout | output indicating the size of the file in bytes. |
Implements mp4v2::platform::io::FileProvider.
|
virtual |
Open file.
| name | filename of file object, or empty-string to use name. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
| mode | bitmask specifying mode flags. See Mode for bit constants. |
Implements mp4v2::platform::io::FileProvider.
Binary stream read.
The function reads up to a maximum size bytes from file, storing them in buffer. The number of bytes actually read are returned in nin.
| buffer | storage for data read from file. |
| size | maximum number of bytes to read from file. |
| nin | output indicating number of bytes read from file. |
Implements mp4v2::platform::io::FileProvider.
|
virtual |
Set current file position in bytes.
| pos | new file position in bytes. |
Implements mp4v2::platform::io::FileProvider.
|
virtual |
Truncate file to length in bytes.
| size | number of bytes to truncate the file to. |
Implements mp4v2::platform::io::FileProvider.
Binary stream write.
The function writes up to a maximum size bytes from buffer to file. The number of bytes actually written are returned in nout.
| buffer | data to be written out to file. |
| size | maximum number of bytes to read from file. |
| nout | output indicating number of bytes written to file. |
Implements mp4v2::platform::io::FileProvider.