|
| BMemoryIO (const void *data, size_t length) |
| Create a read-only object.
|
|
| BMemoryIO (void *data, size_t length) |
| Create a read/write object.
|
|
virtual | ~BMemoryIO () |
| The destructor does nothing.
|
|
virtual off_t | Position () const |
| Return the current position.
|
|
virtual ssize_t | ReadAt (off_t position, void *buffer, size_t size) |
| Read from a given position.
|
|
virtual off_t | Seek (off_t position, uint32 seekMode) |
| Move the cursor to a given position.
|
|
virtual status_t | SetSize (off_t size) |
| Resize the buffer.
|
|
virtual ssize_t | WriteAt (off_t position, const void *buffer, size_t size) |
| Write at a given 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 works on memory buffers.
This class is used if you require access that confirms to the BPositionIO interface on memory buffers that you created. If you would like to use that interface on new buffers, have a look at BMallocIO.
This class is particularly useful if you would like to use a class or method that are written to make use of the BPositionIO interface. It might also be used for 'secure' reading and writing from buffers, since this class automatically checks the bounds of anything you might want to do.
This class reimplements the Read(), Write(), ReadAt(), Writeat(), Seek() and Position() interface from BPositionIO.
- Since
- BeOS R3
status_t BMemoryIO::SetSize |
( |
off_t |
size | ) |
|
|
virtual |
Resize the buffer.
This method does not actually resize the buffer. If the new size is greater than the size of the buffer, resizing will fail. It will only succeed if the new size is less than the size of the buffer. The buffer itself will not be resized though.
This method might be useful in some cases. If the buffer is larger than the data it holds, changing the size will enable you to use the Seek() method with the flag SEEK_END
and not get an error if you read or write from that position, since you actually have a buffer at the end.
- Return values
-
B_OK | The buffer is resized. |
B_NOT_ALLOWED | The buffer is read-only. |
B_ERROR | The size is larger than the size of the buffer. |
- Since
- BeOS R3
Reimplemented from BPositionIO.