#import <ObjectiveLib/ObjectOutStream.h>
Inheritance diagram for OLObjectOutStream:
Public Member Functions | |
(void) | - freeStreamResources |
Free the stream's resources. | |
(void) | - replaceObject:withObject: |
Replace all instances of an object. | |
(void) | - writeBool: |
Write a boolean value to the stream. | |
(void) | - writeClass: |
Write a class. | |
(void) | - writeDouble: |
Write a double value to the stream. | |
(void) | - writeFloat: |
Write a float value to the stream. | |
(void) | - writeHeader |
Write the object stream header. | |
(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) | - writeObject: |
Write an object. | |
Initializers and Deallocators | |
(id) | - initWithOutStream: |
Initialize the stream. | |
Static Public Member Functions | |
(id) | + streamWithOutStream: |
Create and return a new stream. | |
Protected Attributes | |
OLPointerRefTable * | pointerMap |
The map of pointers to object, selectors and classes that assoicates them with handles. | |
OLObjectReplaceTable * | replacementMap |
The map of objects and their replacements. |
In addition to having the ability to write objects and classes, OLObjectOutStream tags every type written to the stream, which is then verified when OLObjectInStream reads the value. If a certain type is expected but another type is found, an exception is raised to indicate the inconsistency. Also, objects and classes are tracked as they are written, and when an object or class is written that already appears in the stream, a handle is written that refers to the instance already written. This improves performance and reduces the size of the resulting data.
- (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 OLLayeredOutStream.
- (id) initWithOutStream: | (OLOutStream *) | underStream |
Initialize the stream.
underStream becomes the next lower stream in the stream stack.
underStream | the stream under the new one in the stream stack |
Reimplemented from OLLayeredOutStream.
- (void) replaceObject: | (id) | obj | ||
withObject: | (id) | rep | ||
Replace all instances of an object.
After receiving this message the stream will always replace any occurrence of obj with rep.
obj | the object to replace | |
rep | the replacement object |
+ (id) streamWithOutStream: | (OLOutStream *) | underStream |
Create and return a new stream.
The underStream becomes the next lower stream in the stream stack.
underStream | the stream under the new one in the stream stack |
- (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 from OLOutStream.
- (void) writeClass: | (Class) | cls |
Write a class.
The class will be written unless this class has already been written to the stream, in which case a reference to it will be written.
OLInputOutputException | if there is an error writing to the stream |
cls | the class to write |
- (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 from OLOutStream.
- (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 from OLOutStream.
- (void) writeHeader |
Write the object stream header.
This method can be overridden to write a custom header to the object stream. It will be called in due course, so it is never necessary to call this method.
OLInputOutputException | if there is an error writing to the stream |
- (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 from OLOutStream.
- (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 from OLOutStream.
- (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 from OLOutStream.
- (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 from OLOutStream.
- (void) writeObject: | (id) | object |
Write an object.
The object will be written unless this object has already been written to the stream, in which case a reference to it will be written.
OLInputOutputException | if there is an error writing to the stream |
object | the object to write |
- (OLPointerRefTable*) pointerMap [protected] |
The map of pointers to object, selectors and classes that assoicates them with handles.
- (OLObjectReplaceTable*) replacementMap [protected] |
The map of objects and their replacements.
|