|
| BMallocIO () |
| Create a new memory buffer with block size 256.
|
|
virtual | ~BMallocIO () |
| Destroy the object and free the internal buffer.
|
|
const void * | Buffer () const |
| Return a pointer to the internal buffer.
|
|
size_t | BufferLength () const |
| Return the number of bytes in the buffer.
|
|
virtual off_t | Position () const |
| Return the position of the cursor.
|
|
virtual ssize_t | ReadAt (off_t position, void *buffer, size_t size) |
| Read data at a certain position.
|
|
virtual off_t | Seek (off_t position, uint32 seekMode) |
| Move the cursor to a given position.
|
|
void | SetBlockSize (size_t blockSize) |
| Change the block size to a certain value.
|
|
virtual status_t | SetSize (off_t size) |
| Change the size of the buffer.
|
|
virtual ssize_t | WriteAt (off_t position, const void *buffer, size_t size) |
| Write data to a certain position.
|
|
| BPositionIO () |
| This constructor does nothing.
|
|
virtual | ~BPositionIO () |
| This destructor does nothing.
|
|
virtual status_t | GetSize (off_t *size) const |
| Get the size of the object or data.
|
|
virtual off_t | Position () const =0 |
| Pure virtual to return the current position of the cursor.
|
|
virtual ssize_t | Read (void *buffer, size_t size) |
| Read data from current position.
|
|
virtual ssize_t | ReadAt (off_t position, void *buffer, size_t size)=0 |
| Pure virtual to read data from a certain position.
|
|
status_t | ReadAtExactly (off_t position, void *buffer, size_t size, size_t *_bytesRead=NULL) |
| Reads an exact amount of data from the object at the specified position into a buffer.
|
|
virtual off_t | Seek (off_t position, uint32 seekMode)=0 |
| Pure virtual to move the cursor to a certain position.
|
|
virtual status_t | SetSize (off_t size) |
| Set the size of the object or data.
|
|
virtual ssize_t | Write (const void *buffer, size_t size) |
| Write data to the current position.
|
|
virtual ssize_t | WriteAt (off_t position, const void *buffer, size_t size)=0 |
| Pure virtual to write data to a certain position.
|
|
status_t | WriteAtExactly (off_t position, const void *buffer, size_t size, size_t *_bytesWritten=NULL) |
| Writes an exact amount of data from a buffer to the object at the specified position.
|
|
| BDataIO () |
| This constructor does nothing.
|
|
virtual | ~BDataIO () |
| This destructor does nothing.
|
|
virtual status_t | Flush () |
| Writes pending data to underlying storage.
|
|
virtual ssize_t | Read (void *buffer, size_t size) |
| Reads data from the object into a buffer.
|
|
status_t | ReadExactly (void *buffer, size_t size, size_t *_bytesRead=NULL) |
| Reads an exact amount of data from the object into a buffer.
|
|
virtual ssize_t | Write (const void *buffer, size_t size) |
| Writes data from a buffer to the object.
|
|
status_t | WriteExactly (const void *buffer, size_t size, size_t *_bytesWritten=NULL) |
| Writes an exact amount of data from a buffer to the object.
|
|
A BPositionIO derived class that creates a memory buffer.
This class creates a memory buffer and provides a BPositionIO interface to work on it. The memory buffer grows and shrinks automatically. This is especially useful if you want to use a method or function that works on an object derived from BPositionIO and you want to do something with the resulting data, or it could be useful if you want to read and write to memory in a safe way, since this class has boundary checking.
BMallocIO allocates a buffer based on a certain block size. This provides a mechanism that will prevent it from needing to allocate new memory too often. The default block size is 256 bytes, you can change it with SetBlockSize(). If you are sure you are going to use a bigger buffer, change the block size so that you won't have to allocate more memory too often, especially if you use this class in performance-critical code.
If you require a BPositionIO derived object that works on buffers you provide, have a look at BMemoryIO.
- Since
- BeOS R3