|
|
|
| MemIo () |
| | Default constructor that results in an empty object.
|
| |
| | MemIo (const byte *data, size_t size) |
| | Constructor that accepts a block of memory. A copy-on-write algorithm allows read operations directly from the original data and will create a copy of the buffer on the first write operation. More...
|
| |
|
| ~MemIo () override |
| | Destructor. Releases all managed memory.
|
| |
|
| int | open () override |
| | Memory IO is always open for reading and writing. This method therefore only resets the IO position to the start. More...
|
| |
| int | close () override |
| | Does nothing on MemIo objects. More...
|
| |
| size_t | write (const byte *data, size_t wcount) override |
| | Write data to the memory block. If needed, the size of the internal memory block is expanded. The IO position is advanced by the number of bytes written. More...
|
| |
| size_t | write (BasicIo &src) override |
| | Write data that is read from another BasicIo instance to the memory block. If needed, the size of the internal memory block is expanded. The IO position is advanced by the number of bytes written. More...
|
| |
| int | putb (byte data) override |
| | Write one byte to the memory block. The IO position is advanced by one byte. More...
|
| |
| DataBuf | read (size_t rcount) override |
| | Read data from the memory block. Reading starts at the current IO position and the position is advanced by the number of bytes read. More...
|
| |
| size_t | read (byte *buf, size_t rcount) override |
| | Read data from the memory block. Reading starts at the current IO position and the position is advanced by the number of bytes read. More...
|
| |
| int | getb () override |
| | Read one byte from the memory block. The IO position is advanced by one byte. More...
|
| |
| void | transfer (BasicIo &src) override |
| | Clear the memory block and then transfer data from the src BasicIo object into a new block of memory. More...
|
| |
| int | seek (int64_t offset, Position pos) override |
| | Move the current IO position. More...
|
| |
| byte * | mmap (bool=false) override |
| | Allow direct access to the underlying data buffer. The buffer is not protected against write access in any way, the argument is ignored. More...
|
| |
| int | munmap () override |
| | Remove a mapping established with mmap(). If the mapped area is writeable, this ensures that changes are written back. More...
|
| |
|
virtual | ~BasicIo ()=default |
| | Destructor.
|
| |
| void | readOrThrow (byte *buf, size_t rcount, ErrorCode err=ErrorCode::kerCorruptedMetadata) |
| | Safe version of read() that checks for errors and throws an exception if the read was unsuccessful. More...
|
| |
| void | seekOrThrow (int64_t offset, Position pos, ErrorCode err) |
| | Safe version of seek() that checks for errors and throws an exception if the seek was unsuccessful. More...
|
| |
|
| size_t | tell () const override |
| | Get the current IO position. More...
|
| |
| size_t | size () const override |
| | Get the current memory buffer size in bytes. More...
|
| |
|
bool | isopen () const override |
| | Always returns true.
|
| |
|
int | error () const override |
| | Always returns 0.
|
| |
|
bool | eof () const override |
| | Returns true if the IO position has reached the end, otherwise false.
|
| |
|
const std::string & | path () const noexcept override |
| | Returns a dummy path, indicating that memory access is used.
|
| |
| void | populateFakeData () override |
| | Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain image-date (non-metadata/pixel data) More...
|
| |
|
| MemIo (const MemIo &)=delete |
| | Copy constructor.
|
| |
|
MemIo & | operator= (const MemIo &)=delete |
| | Assignment operator.
|
| |
Provides binary IO on blocks of memory by implementing the BasicIo interface. A copy-on-write implementation ensures that the data passed in is only copied when necessary, i.e., as soon as data is written to the MemIo. The original data is only used for reading. If writes are performed, the changed data can be retrieved using the read methods (since the data used in construction is never modified).
- Note
- If read only usage of this class is common, it might be worth creating a specialized readonly class or changing this one to have a readonly mode.
| void Exiv2::MemIo::transfer |
( |
BasicIo & |
src | ) |
|
|
overridevirtual |
Clear the memory block and then transfer data from the src BasicIo object into a new block of memory.
This method is optimized to simply swap memory block if the source object is another MemIo instance. The source BasicIo instance 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.
- Parameters
-
| src | Reference to another BasicIo instance. The entire contents of src are transferred to this object. The src object is invalidated by the method. |
- Exceptions
-
Implements Exiv2::BasicIo.
References Exiv2::BasicIo::open().