OLBzlibOutStream Class Reference
[Streams]

A stream for bzlib compression. More...

#import <ObjectiveLib/BzlibOutStream.h>

Inheritance diagram for OLBzlibOutStream:

Inheritance graph
[legend]
List of all members.

Public Member Functions

(void) - close
 Close the stream.
(void) - freeStreamResources
 Free the stream's resources.
(unsigned) - writeBytes:count:
 Write a sequence of bytes to the stream.
Initializers and Deallocators
(id) - initWithOutStream:
 Initialize the compression stream.
(id) - initWithOutStream:blockSize:
 Initialize the compression stream.
(id) - initWithOutStream:blockSize:bufferSize:
 Initialize the compression stream.

Static Public Member Functions

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

Protected Attributes

uint8_t * buffer
 The buffer required by bzlib.
unsigned bufferSize
 The size of the zlib buffer.
void * bzstream
 The opaque data type used by bzlib to represent the stream.

Detailed Description

A stream for bzlib compression.

This is a concrete layered stream that compresses all data written using the library bzlib. The bzlib library is very similar to the zlib compression library, except that it compresses much better and usually more slowly than zlib.

Note:
Data written through OLBzlibOutStream is suitable for reading using the command-line tool bzip2.
See also:
OLBzlibInStream, OLZlibOutStream


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 from OLLayeredOutStream.

- (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.

Note:
All sublcasses that allocate resources must implement this method to free those resources and call [super freeStreamResources].

Reimplemented from OLLayeredOutStream.

- (id) initWithOutStream: (OLOutStream *)  underStream  

Initialize the compression stream.

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

Exceptions:
OLInputOutputException if the stream cannot be created for compression
Parameters:
underStream the next lower stream in the stack
Returns:
a reference to this stream

Reimplemented from OLLayeredOutStream.

- (id) initWithOutStream: (OLOutStream *)  underStream
blockSize: (int)  block 

Initialize the compression stream.

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

Precondition:
The indicated block must be in the range [1,9].
Exceptions:
OLInputOutputException if the stream cannot be created for compression
Parameters:
underStream the next lower stream in the stack
block the block size which must be in the range [1,9]
Returns:
a reference to this stream

- (id) initWithOutStream: (OLOutStream *)  underStream
blockSize: (int)  block
bufferSize: (unsigned)  size 

Initialize the compression stream.

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

Precondition:
The indicated block must be in the range [1,9].
Exceptions:
OLInputOutputException if the stream cannot be created for compression
Parameters:
underStream the next lower stream in the stack
block the block size which must be in the range [1,9]
size the buffer size
Returns:
a reference to this stream

+ (id) streamWithOutStream: (OLOutStream *)  underStream  

Create and return a new compression stream.

The stream uses a block size of 9 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:
OLInputOutputException if the stream cannot be created for compression
Parameters:
underStream the next lower stream in the stack
Returns:
a reference to the newly created stream

+ (id) streamWithOutStream: (OLOutStream *)  underStream
blockSize: (int)  block 

Create and return a new compression stream.

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

Precondition:
The indicated block must be in the range [1,9].
Note:
If OpenStep is present the returned object will be autoreleased before being returned.
Exceptions:
OLInvalidArgumentException if the block size is not in the range [1,9]
OLInputOutputException if the stream cannot be created for compression
Parameters:
underStream the next lower stream in the stack
block the block size which must be in the range [1,9]
Returns:
a reference to the newly created stream

- (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:
OLInputOutputException if there is an error writing to the stream
Parameters:
bytes the bytes to write
num the number of bytes to write
Returns:
the number of bytes written

Reimplemented from OLLayeredOutStream.


Member Data Documentation

- (uint8_t*) buffer [protected]

The buffer required by bzlib.

- (unsigned) bufferSize [protected]

The size of the zlib buffer.

- (void*) bzstream [protected]

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


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