ObjectiveLib  1.0.0
Public Member Functions | Static Public Member Functions | Protected Attributes
OLZlibOutStream Class Reference

A stream for zlib compression. More...

#import <ObjectiveLib/ZlibOutStream.h>

Inheritance diagram for OLZlibOutStream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(void) - close
 Close the stream.
(unsigned) - writeBytes:count:
 Write a sequence of bytes to the stream.
Initializers and Deallocators
(id) - initWithOutStream:
 Initialize the compression stream.
(id) - initWithOutStream:compressionLevel:
 Initialize the compression stream.
(id) - initWithOutStream:compressionLevel:bufferSize:
 Initialize the compression stream.
(id) - initWithOutStream:compressionLevel:bufferSize:writeZlibHeader:
 Initialize the compression stream.
(void) - dealloc
 Finalize the stream and deallocate any allocated memory.

Static Public Member Functions

(id) + streamWithOutStream:
 Create and return a new compression stream.
(id) + streamWithOutStream:compressionLevel:
 Create and return a new compression stream.

Protected Attributes

uint8_t * buffer
 The buffer required by zlib.
unsigned bufferSize
 The size of the zlib buffer.
BOOL isFinished
 Indicator of whether the compression has finished yet.
struct z_stream_s * zstream
 The opaque data type used by zlib to represent the stream.

Detailed Description

A stream for zlib compression.

This is a concrete layered stream that compresses all data written using the library zlib.

See also:
OLZlibInStream

Member Function Documentation

- (void) close

Close the stream.

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

Exceptions:
OLInputOutputExceptionif there is an error closing the stream

Reimplemented from OLLayeredOutStream.

Reimplemented in OLGzipOutStream.

- (void) dealloc

Finalize the stream and deallocate any allocated memory.

Reimplemented from OLLayeredOutStream.

Reimplemented in OLGzipOutStream.

- (id) initWithOutStream: (OLOutStream *)  underStream

Initialize the compression stream.

The stream uses the default compression level and a buffer size of 1,024. The given out stream underStream is the next lower stream in the stream stack.

Exceptions:
OLInputOutputExceptionif the stream cannot be created for deflation
Parameters:
underStreamthe next lower stream in the stack
Returns:
a reference to this stream

Reimplemented from OLLayeredOutStream.

- (id) initWithOutStream: (OLOutStream *)  underStream
compressionLevel: (int)  level 

Initialize the compression stream.

The stream uses the given compression level and a buffer size of 1,024. The given out stream underStream is the next lower stream in the stream stack.

Precondition:
The indicated compression level must be in the range [0,9].
Exceptions:
NSInvalidArgumentExceptionif the compression level is not in the range [0,9]
OLInputOutputExceptionif the stream cannot be created for deflation
Parameters:
underStreamthe next lower stream in the stack
levelthe compression level which must be in the range [0,9]
Returns:
a reference to this stream
- (id) initWithOutStream: (OLOutStream *)  underStream
compressionLevel: (int)  level
bufferSize: (unsigned)  size 

Initialize the compression stream.

The stream uses the given compression level and buffer size. The given out stream underStream is the next lower stream in the stream stack.

Precondition:
The indicated compression level must be in the range [0,9].
Exceptions:
NSInvalidArgumentExceptionif the compression level is not in the range [0,9]
OLInputOutputExceptionif the stream cannot be created for deflation
Parameters:
underStreamthe next lower stream in the stack
levelthe compression level which must be in the range [0,9]
sizethe size of the internal buffer
Returns:
a reference to this stream
- (id) initWithOutStream: (OLOutStream *)  underStream
compressionLevel: (int)  level
bufferSize: (unsigned)  size
writeZlibHeader: (BOOL)  zlibHeader 

Initialize the compression stream.

The stream uses the given compression level and buffer size. The given out stream underStream is the next lower stream in the stream stack. If zlibHeader is YES, then the zlib header will be written to the stream, otherwise it will not be written.

Attention:
You probably do not want to use this initializer. This initializer exists so that subclasses will have maximum control over how the zstream is created. Do not use this initializer unless you know what you are doing.
Precondition:
The indicated compression level must be in the range [0,9].
Exceptions:
NSInvalidArgumentExceptionif the compression level is not in the range [0,9]
OLInputOutputExceptionif the stream cannot be created for deflation
Parameters:
underStreamthe next lower stream in the stack
levelthe compression level which must be in the range [0,9]
sizethe size of the internal buffer
zlibHeadershould be YES if the zlib header should be written to the stream, otherwise NO
Returns:
a reference to this stream

Reimplemented in OLGzipOutStream.

+ (id) streamWithOutStream: (OLOutStream *)  underStream

Create and return a new compression stream.

The stream uses the default compression level and a buffer size of 1,024. The given out stream underStream is the next lower stream in the stream stack.

Note:
If OpenStep is present the returned object will be autoreleased before being returned.
Exceptions:
OLInputOutputExceptionif the stream cannot be created for deflation
Parameters:
underStreamthe next lower stream in the stack
Returns:
a reference to the newly created stream

Reimplemented in OLGzipOutStream.

+ (id) streamWithOutStream: (OLOutStream *)  underStream
compressionLevel: (int)  level 

Create and return a new compression stream.

The stream uses the given compression level and a buffer size of 1,024. The given out stream underStream is the next lower stream in the stream stack.

Precondition:
The indicated compression level must be in the range [0,9].
Note:
If OpenStep is present the returned object will be autoreleased before being returned.
Exceptions:
NSInvalidArgumentExceptionif the compression level is not in the range [0,9]
OLInputOutputExceptionif the stream cannot be created for deflation
Parameters:
underStreamthe next lower stream in the stack
levelthe compression level which must be in the range [0,9]
Returns:
a reference to the newly created stream

Reimplemented in OLGzipOutStream.

- (unsigned) writeBytes: (const uint8_t *)  bytes
count: (unsigned)  num 

Write a sequence of bytes to the stream.

Compress up to num bytes and return the number actually written.

Exceptions:
OLInputOutputExceptionif there is an error writing to the stream
Parameters:
bytesthe bytes to write
numthe number of bytes to write
Returns:
the number of bytes written

Reimplemented from OLLayeredOutStream.

Reimplemented in OLGzipOutStream.


Member Data Documentation

- (uint8_t*) buffer [protected]

The buffer required by zlib.

- (unsigned) bufferSize [protected]

The size of the zlib buffer.

- (BOOL) isFinished [protected]

Indicator of whether the compression has finished yet.

- (struct z_stream_s*) zstream [protected]

The opaque data type used by zlib to represent the stream.


The documentation for this class was generated from the following file:

ObjectiveLibGenerated Sat Feb 15 2014 07:45:35, © 2004-2007 Will Mason