#include <memfile.h>
Inheritance diagram for PMemoryFile:
Public Member Functions | |
Construction | |
PMemoryFile () | |
PMemoryFile (const PBYTEArray &data) | |
Overrides from class PObject | |
Comparison | Compare (const PObject &obj) const |
Overrides from class PChannel | |
virtual PBoolean | Read (void *buf, PINDEX len) |
virtual PBoolean | Write (const void *buf, PINDEX len) |
Overrides from class PFile | |
off_t | GetLength () const |
PBoolean | SetLength (off_t len) |
PBoolean | SetPosition (off_t pos, FilePositionOrigin origin=Start) |
off_t | GetPosition () const |
Overrides from class PFile | |
const PBYTEArray & | GetData () const |
Protected Attributes | |
PBYTEArray | data |
off_t | position |
PMemoryFile::PMemoryFile | ( | ) |
Create a new, empty, memory file.
PMemoryFile::PMemoryFile | ( | const PBYTEArray & | data | ) |
Create a new memory file initialising to the specified content.
data | New content filr memory file. |
Comparison PMemoryFile::Compare | ( | const PObject & | obj | ) | const [virtual] |
const PBYTEArray& PMemoryFile::GetData | ( | ) | const [inline] |
Get the memory data the file has operated with.
off_t PMemoryFile::GetLength | ( | ) | const [virtual] |
Get the current size of the file. The size of the file corresponds to the size of the data array.
Reimplemented from PFile.
off_t PMemoryFile::GetPosition | ( | ) | const [virtual] |
Get the current active position in the file for the next read or write operation.
Reimplemented from PFile.
virtual PBoolean PMemoryFile::Read | ( | void * | buf, | |
PINDEX | len | |||
) | [virtual] |
Low level read from the memory file channel. The read timeout is ignored. The GetLastReadCount() function returns the actual number of bytes read.
The GetErrorCode() function should be consulted after Read() returns PFalse to determine what caused the failure.
buf | Pointer to a block of memory to receive the read bytes. |
len | Maximum number of bytes to read into the buffer. |
Reimplemented from PFile.
PBoolean PMemoryFile::SetLength | ( | off_t | len | ) | [virtual] |
Set the size of the file, padding with 0 bytes if it would require expanding the file, or truncating it if being made shorter.
len | New length of file. |
Reimplemented from PFile.
PBoolean PMemoryFile::SetPosition | ( | off_t | pos, | |
FilePositionOrigin | origin = Start | |||
) |
Set the current active position in the file for the next read or write operation. The pos# variable is a signed number which is added to the specified origin. For origin == PFile::Start# only positive values for pos# are meaningful. For origin == PFile::End# only negative values for pos# are meaningful.
pos | New position to set. |
origin | Origin for position change. |
virtual PBoolean PMemoryFile::Write | ( | const void * | buf, | |
PINDEX | len | |||
) | [virtual] |
Low level write to the memory file channel. The write timeout is ignored. The GetLastWriteCount() function returns the actual number of bytes written.
The GetErrorCode() function should be consulted after Write() returns PFalse to determine what caused the failure.
buf | Pointer to a block of memory to write. |
len | Number of bytes to write. |
Reimplemented from PFile.
PBYTEArray PMemoryFile::data [protected] |
off_t PMemoryFile::position [protected] |