OLOutStream Class Reference
[Streams]

Base class for writing data. More...

#import <ObjectiveLib/OutStream.h>

Inheritance diagram for OLOutStream:

Inheritance graph
[legend]
List of all members.

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.

Detailed Description

Base class for writing data.

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.

Note:
Object instances and classes cannot be written using OLOutStream. An instance of OLObjectOutStream must be used instead. The NSCoder support provided in OLOutStream is merely a byproduct of the class hierarchy imposed by NSCoder.


Member Function Documentation

- (void) close  

Close the stream.

After receiving this message the stream will no longer be available for writing.

Exceptions:
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.

Exceptions:
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).

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
bytes the bytes to write
count the number of bytes to write
Returns:
the number of bytes written

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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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.

Note:
Regardless of the size of the type int on the platform being used, the value written will always be exactly four bytes long.
Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
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).

Exceptions:
OLInputOutputException if there is an error writing to the stream
Parameters:
sel the selector to write


The documentation for this class was generated from the following file:
ObjectiveLibGenerated Sun Apr 22 15:18:57 2007, © 2004-2007 Will Mason
SourceForge.net Logo