#import <ObjectiveLib/OutStream.h>
Inheritance diagram for OLOutStream:
Public Member Functions | |
(void) | - close |
Close the stream. | |
(void) | - flush |
Flush the stream. | |
(void) | - writeBool: |
Write a boolean value to the stream. | |
(void) | - writeByte: |
Write a byte to the stream. | |
(unsigned) | - writeBytes:count: |
Write a sequence of bytes to the stream. | |
(void) | - writeDouble: |
Write a double value to the stream. | |
(void) | - writeFloat: |
Write a float value to the stream. | |
(void) | - writeInt16: |
Write a 16-bite integer value to the stream. | |
(void) | - writeInt32: |
Write a 32-bit integer value to the stream. | |
(void) | - writeInt64: |
Write a 64-bit integer value to the stream. | |
(void) | - writeInt: |
Write a integer value to the stream. | |
(void) | - writeSelector: |
Write a selector to the stream. |
OLOutStream provides the basic stream services which include writing 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 write themselves through an instance of OLObjectOutStream. The lower-level methods provided by OLOutStream 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 longer be available for writing.
OLInputOutputException | if there is an error closing the stream |
Reimplemented in OLBzlibOutStream, OLFileOutStream, OLGzipOutStream, OLLayeredOutStream, and OLZlibOutStream.
- (void) flush |
Flush the stream.
Any data that is pending or buffered will be written and the stream will be restored to a pristine state.
OLInputOutputException | if there is an error flushing the stream |
Reimplemented in OLBufferingOutStream, OLFileOutStream, and OLLayeredOutStream.
- (void) writeBool: | (BOOL) | value |
Write a boolean value to the stream.
The value is written in a platform-independent way and can be read using readBool (OLInStream). Specifically, the value is written as a single byte with a value of 1 if value is YES (or non-zero), and as a single byte with a value of 0 if value is NO (or zero).
OLInputOutputException | if there is an error writing to the stream |
value | the boolean value to write |
Reimplemented in OLObjectOutStream.
- (void) writeByte: | (uint8_t) | byte |
Write a byte to the stream.
The default implementation of this method is to call writeBytes:count:, so subclasses that can optimize writing one byte should do so.
OLInputOutputException | if there is an error writing to the stream |
byte | the byte to write |
Reimplemented in OLBufferingOutStream.
- (unsigned) writeBytes: | (const uint8_t *) | bytes | ||
count: | (unsigned) | count | ||
Write a sequence of bytes to the stream.
This is the fundamental method for writing to a stream, and subclasses must override this method.
OLInputOutputException | if there is an error writing to the stream |
bytes | the bytes to write | |
count | the number of bytes to write |
Reimplemented in OLBufferingOutStream, OLBzlibOutStream, OLDataOutStream, OLFileOutStream, OLGzipOutStream, OLLayeredOutStream, and OLZlibOutStream.
- (void) writeDouble: | (double) | value |
Write a double value to the stream.
The double is written in a platform-independent way and can be read using readDouble (OLInStream). Specifically, the value is written as an 8-byte array in network byte order.
OLInputOutputException | if there is an error writing to the stream |
value | the double value to write |
Reimplemented in OLObjectOutStream.
- (void) writeFloat: | (float) | value |
Write a float value to the stream.
The float is written in a platform-independent way and can be read using readFloat (OLInStream). Specifically, the value is written as a 4-byte array in network byte order.
OLInputOutputException | if there is an error writing to the stream |
value | the float value to write |
Reimplemented in OLObjectOutStream.
- (void) writeInt16: | (uint16_t) | value |
Write a 16-bite integer value to the stream.
The integer is written in a platform-independent way and can be read using readInt16 (OLInStream). Specifically, the value is written as a 2-byte array in network byte order.
OLInputOutputException | if there is an error writing to the stream |
value | the integer value to write |
Reimplemented in OLObjectOutStream.
- (void) writeInt32: | (uint32_t) | value |
Write a 32-bit integer value to the stream.
The integer is written in a platform-independent way and can be read using readInt32 (OLInStream). Specifically, the value is written as a 4-byte array in network byte order.
OLInputOutputException | if there is an error writing to the stream |
value | the integer value to write |
Reimplemented in OLObjectOutStream.
- (void) writeInt64: | (uint64_t) | value |
Write a 64-bit integer value to the stream.
The integer is written in a platform-independent way and can be read using readInt64 (OLInStream). Specifically, the value is written as an 8-byte array in network byte order.
OLInputOutputException | if there is an error writing to the stream |
value | the integer value to write |
Reimplemented in OLObjectOutStream.
- (void) writeInt: | (unsigned) | value |
Write a integer value to the stream.
The integer is written in a platform-independent way and can be read using readInt (OLInStream). Specifically, the value is written as a 4-byte array in network byte order.
int
on the platform being used, the value written will always be exactly four bytes long.OLInputOutputException | if there is an error writing to the stream |
value | the integer value to write |
Reimplemented in OLObjectOutStream.
- (void) writeSelector: | (SEL) | sel |
Write a selector to the stream.
The selector can later be read from an OLInStream using the method readSelector (OLInStream).
OLInputOutputException | if there is an error writing to the stream |
sel | the selector to write |
|