#include <basicio.hpp>
Inheritance diagram for Exiv2::FileIo:
Public Member Functions | |
Creators | |
FileIo (const std::string &path) | |
Constructor that accepts the file path on which IO will be performed. The constructor does not open the file, and therefore never failes. | |
virtual | ~FileIo () |
Destructor. Flushes and closes an open file. | |
Manipulators | |
int | open (const std::string &mode) |
Open the file using using the specified mode. | |
virtual int | open () |
Open the file using using the default access mode of "rb". This method can also be used to "reopen" a file which will flush any unwritten data and reset the IO position to the start. | |
virtual int | close () |
Flush and unwritten data and close the file . It is safe to call close on an already closed instance. | |
virtual long | write (const byte *data, long wcount) |
Write data to the file. The file position is advanced by the number of bytes written. | |
virtual long | write (BasicIo &src) |
Write data that is read from another BasicIo instance to the file. The file position is advanced by the number of bytes written. | |
virtual int | putb (byte data) |
Write one byte to the file. The file position is advanced by one byte. | |
virtual DataBuf | read (long rcount) |
Read data from the file. Reading starts at the current file position and the position is advanced by the number of bytes read. | |
virtual long | read (byte *buf, long rcount) |
Read data from the file. Reading starts at the current file position and the position is advanced by the number of bytes read. | |
virtual int | getb () |
Read one byte from the file. The file position is advanced by one byte. | |
virtual void | transfer (BasicIo &src) |
Remove the contents of the file and then transfer data from the src BasicIo object into the empty file. | |
virtual int | seek (long offset, Position pos) |
Move the current file position. | |
virtual byte * | mmap (bool isWriteable=false) |
Map the file into the process's address space. The file must be open before mmap() is called. If the mapped area is writeable, changes may not be written back to the underlying file until munmap() is called. The pointer is valid only as long as the FileIo object exists. | |
virtual int | munmap () |
Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes are written back to the underlying file. | |
Accessors | |
virtual long | tell () const |
Get the current file position. | |
virtual long | size () const |
Flush any buffered writes and get the current file size in bytes. | |
virtual bool | isopen () const |
Returns true if the file is open, otherwise false. | |
virtual int | error () const |
Returns 0 if the file is in a valid state, otherwise nonzero. | |
virtual bool | eof () const |
Returns true if the file position has reach the end, otherwise false. | |
virtual std::string | path () const |
Returns the path of the file. | |
virtual BasicIo::AutoPtr | temporary () const |
Returns a temporary data storage location. The actual type returned depends upon the size of the file represented a FileIo object. For small files, a MemIo is returned while for large files a FileIo is returned. Callers should not rely on this behavior, however, since it may change. |
|
Constructor that accepts the file path on which IO will be performed. The constructor does not open the file, and therefore never failes.
|
|
Flush and unwritten data and close the file . It is safe to call close on an already closed instance.
Implements Exiv2::BasicIo. |
|
Read one byte from the file. The file position is advanced by one byte.
Implements Exiv2::BasicIo. |
|
Map the file into the process's address space. The file must be open before mmap() is called. If the mapped area is writeable, changes may not be written back to the underlying file until munmap() is called. The pointer is valid only as long as the FileIo object exists.
Implements Exiv2::BasicIo. |
|
Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes are written back to the underlying file.
Implements Exiv2::BasicIo. |
|
Open the file using using the default access mode of "rb". This method can also be used to "reopen" a file which will flush any unwritten data and reset the IO position to the start.
Implements Exiv2::BasicIo. |
|
Open the file using using the specified mode. This method can also be used to "reopen" a file which will flush any unwritten data and reset the IO position to the start. Although files can be opened in binary or text mode, this class has only been tested carefully in binary mode.
|
|
Write one byte to the file. The file position is advanced by one byte.
Implements Exiv2::BasicIo. |
|
Read data from the file. Reading starts at the current file position and the position is advanced by the number of bytes read.
Implements Exiv2::BasicIo. |
|
Read data from the file. Reading starts at the current file position and the position is advanced by the number of bytes read.
Implements Exiv2::BasicIo. |
|
Move the current file position.
Implements Exiv2::BasicIo. |
|
Flush any buffered writes and get the current file size in bytes.
Implements Exiv2::BasicIo. |
|
Get the current file position.
Implements Exiv2::BasicIo. |
|
Returns a temporary data storage location. The actual type returned depends upon the size of the file represented a FileIo object. For small files, a MemIo is returned while for large files a FileIo is returned. Callers should not rely on this behavior, however, since it may change.
Implements Exiv2::BasicIo. |
|
Remove the contents of the file and then transfer data from the src BasicIo object into the empty file. This method is optimized to simply rename the source file if the source object is another FileIo instance. The source BasicIo object is invalidated by this operation and should not be used after this method returns. This method exists primarily to be used with the BasicIo::temporary() method.
Implements Exiv2::BasicIo. |
|
Write data that is read from another BasicIo instance to the file. The file position is advanced by the number of bytes written.
Implements Exiv2::BasicIo. |
|
Write data to the file. The file position is advanced by the number of bytes written.
Implements Exiv2::BasicIo. |