#import <ObjectiveLib/InStream.h>
Inheritance diagram for OLInStream:
Public Member Functions | |
(void) | - close |
Close the stream. | |
(BOOL) | - readBool |
Read a boolean value from the stream. | |
(uint8_t) | - readByte |
Read a byte from the stream. | |
(unsigned) | - readBytes:count: |
Read a sequence of bytes from the stream. | |
(double) | - readDouble |
Read a double value from the stream. | |
(float) | - readFloat |
Read a float value from the stream. | |
(unsigned) | - readInt |
Read an integer value from the stream. | |
(uint16_t) | - readInt16 |
Read a 16-bit integer value from the stream. | |
(uint32_t) | - readInt32 |
Read a 32-bit integer value from the stream. | |
(uint64_t) | - readInt64 |
Read a 64-bit integer value from the stream. | |
(SEL) | - readSelector |
Read a selector from the stream. |
OLInStream provides the basic stream services which include reading primitive data types and the services of NSCoder. The NSCoder services are provided in order to allow objects which already support the NSCoding protocol to read themselves through an instance of OLObjectInStream. The lower-level methods provided by OLInStream are preferred for new code. Obviously, the NSCoder support is only available if ObjectiveLib was built with OpenStep support.
- (void) close |
Close the stream.
After receiving this message the stream will no long be available for reading.
OLInputOutputException | if there is an error closing the stream |
Reimplemented in OLBzlibInStream, OLFileInStream, OLLayeredInStream, and OLZlibInStream.
- (BOOL) readBool |
Read a boolean value from the stream.
The value is read as if it had been written by writeBool: (OLOutStream). Specifically, one byte of data is read and YES is returned if that byte is non-zero, otherwise NO is returned.
OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (uint8_t) readByte |
Read a byte from the stream.
The default implementation of this method is to call readBytes:count:, so subclasses that can optimize reading one byte should do so.
OLInputOutputException | if there is an error reading from the stream | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLBufferingInStream, and OLDataInStream.
- (unsigned) readBytes: | (uint8_t *) | buffer | ||
count: | (unsigned) | max | ||
Read a sequence of bytes from the stream.
This is the fundamental method for reading from a stream, and subclasses must override this method. The number of bytes read is returned except in the case where the end of the stream has been reached. Rather than raising an exception in this case, this method returns UINT_MAX.
OLInputOutputException | if there is an error reading from the stream |
buffer | the address to which the bytes should be read | |
max | the maximum number bytes that should be read |
Reimplemented in OLBufferingInStream, OLBzlibInStream, OLDataInStream, OLFileInStream, OLGzipInStream, OLLayeredInStream, and OLZlibInStream.
- (double) readDouble |
Read a double value from the stream.
The value is read as if it had been written by writeDouble: (OLOutStream). Specifically, an 8-byte field of data is read and converted from network byte order to host byte order.
OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (float) readFloat |
Read a float value from the stream.
The value is read as if it had been written by writeFloat: (OLOutStream). Specifically, an 4-byte field of data is read and converted from network byte order to host byte order.
OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (unsigned) readInt |
Read an integer value from the stream.
The value is read as if it had been written by writeInt: (OLOutStream). Specifically, an 4-byte field of data is read and converted from network byte order to host byte order.
int
on the platform being used, the value read will always be exactly four bytes long and returned as an unsigned
value.OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (uint16_t) readInt16 |
Read a 16-bit integer value from the stream.
The value is read as if it had been written by writeInt16: (OLOutStream). Specifically, an 2-byte field of data is read and converted from network byte order to host byte order.
OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (uint32_t) readInt32 |
Read a 32-bit integer value from the stream.
The value is read as if it had been written by writeInt32: (OLOutStream). Specifically, an 4-byte field of data is read and converted from network byte order to host byte order.
OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (uint64_t) readInt64 |
Read a 64-bit integer value from the stream.
The value is read as if it had been written by writeInt64: (OLOutStream). Specifically, an 8-byte field of data is read and converted from network byte order to host byte order.
OLInputOutputException | if the value could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
Reimplemented in OLObjectInStream.
- (SEL) readSelector |
Read a selector from the stream.
The value is read as if it had been written by writeSelector: (OLOutStream).
OLInputOutputException | if the selector could not be read | |
OLEndOfStreamException | if the end of the stream has been reached |
|