#import <ObjectiveLib/DataInStream.h>
Inheritance diagram for OLDataInStream:
Public Member Functions | |
(uint8_t) | - readByte |
Read a byte from the stream. | |
(unsigned) | - readBytes:count: |
Read a sequence of bytes from the stream. | |
Initializers and Deallocators | |
(void) | - dealloc |
(id) | - initWithBytes:count: |
Initialize the stream. | |
(id) | - initWithDataObject: |
Initialize the stream. | |
Static Public Member Functions | |
(id) | + streamWithBytes:count: |
Create and return a new stream. | |
(id) | + streamWithDataObject: |
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.
- (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 |
- (id) initWithDataObject: | (NSData *) | data |
Initialize the stream.
The stream copies the data from the given data object.
data | the data object used to initialize the stream |
- (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 |
+ (id) streamWithDataObject: | (NSData *) | data |
Create and return a new stream.
The given data object is used to initialize the stream. The returned stream is autoreleased before being returned.
data | the data from which the stream will read |
- (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.
|