#import <ObjectiveLib/DataInStream.h>
Inheritance diagram for OLDataInStream:
Public Member Functions | |
(void) | - freeStreamResources |
Free the stream's resources. | |
(uint8_t) | - readByte |
Read a byte from the stream. | |
(unsigned) | - readBytes:count: |
Read a sequence of bytes from the stream. | |
Initializers and Deallocators | |
(id) | - initWithBytes:count: |
Initialize the stream. | |
Static Public Member Functions | |
(id) | + streamWithBytes:count: |
Create and return a new stream. | |
Protected Attributes | |
unsigned | byteCount |
The number of bytes in the buffer. | |
uint8_t * | bytes |
The memory buffer from which data is read. | |
unsigned | position |
The current position from which to read. |
This is a concrete connected stream that reads all of its data from a memory buffer.
- (void) freeStreamResources |
Free the stream's resources.
This secondary freeing method is necessary to allow the reference count to be properly manipulated from within the normal free (OLReferenceCountedStream) method.
Reimplemented from OLReferenceCountedStream.
- (id) initWithBytes: | (const uint8_t *) | buffer | ||
count: | (unsigned) | length | ||
Initialize the stream.
The contents of buffer are copied into the stream's buffer.
buffer | the bytes from which the stream should read | |
length | the number of bytes |
- (uint8_t) readByte |
Read a byte from the stream.
This optimized version of reading a byte merely copies a byte from the memory buffer unless there is no more data in the buffer.
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented from OLInStream.
- (unsigned) readBytes: | (uint8_t *) | buffer | ||
count: | (unsigned) | max | ||
Read a sequence of bytes from the stream.
Bytes are copied from the buffer unless the end of the buffer had already been reached before this message was sent. In case there is no more data in the buffer the message returns UINT_MAX.
buffer | the address to which the bytes should be read | |
max | the maximum number bytes that should be read |
Reimplemented from OLInStream.
+ (id) streamWithBytes: | (const uint8_t *) | buffer | ||
count: | (unsigned) | length | ||
Create and return a new stream.
The contents of the given buffer are copied and the data are then used as the source of this connected stream.
buffer | the bytes to use as the data source | |
length | the number of bytes |
- (unsigned) byteCount [protected] |
The number of bytes in the buffer.
- (uint8_t*) bytes [protected] |
The memory buffer from which data is read.
- (unsigned) position [protected] |
The current position from which to read.
|