OLBzlibInStream Class Reference
[Streams]

A stream for bzlib decompression. More...

#import <ObjectiveLib/BzlibInStream.h>

Inheritance diagram for OLBzlibInStream:

Inheritance graph
[legend]
List of all members.

Public Member Functions

(void) - close
 Close the stream.
(void) - freeStreamResources
 Free the stream's resources.
(unsigned) - readBytes:count:
 Read a sequence of bytes from the stream.
Initializers and Deallocators
(id) - initWithInStream:
 Initialize the stream.
(id) - initWithInStream:bufferSize:
 Initialize the stream.
(id) - initWithInStream:bufferSize:smallMode:
 Initialize the stream.

Static Public Member Functions

(id) + streamWithInStream:
 Create and return a newly created stream.

Protected Attributes

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

Detailed Description

A stream for bzlib decompression.

This is a concrete layered stream that decompresses all data read using the library bzlib. It is suitable for reading data compressed with OLBzlibOutStream.

Note:
OLBzlibInStream is suitable for reading data written using the command-line tool bzip2.
See also:
OLZlibOutStream


Member Function Documentation

- (void) close  

Close the stream.

After receiving this message the stream will no long be available for reading.

Exceptions:
OLInputOutputException if there is an error closing the stream

Reimplemented from OLLayeredInStream.

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

- (id) initWithInStream: (OLInStream *)  underStream  

Initialize the stream.

The stream is created with a buffer size of 1,024. The given stream underStream will become the next layer down in the stack of streams.

Exceptions:
OLInputOutputException if the stream cannot be created for inflation
Parameters:
underStream the stream from which to read data
Returns:
a reference to this stream

Reimplemented from OLLayeredInStream.

- (id) initWithInStream: (OLInStream *)  underStream
bufferSize: (unsigned)  size 

Initialize the stream.

The stream is created with the given buffer size. The given stream underStream will become the next layer down in the stack of streams.

Exceptions:
OLInputOutputException if the stream cannot be created for inflation
Parameters:
underStream the stream from which to read data
size the buffer size
Returns:
a reference to this stream

- (id) initWithInStream: (OLInStream *)  underStream
bufferSize: (unsigned)  size
smallMode: (BOOL)  sm 

Initialize the stream.

The stream is created with the given buffer size. The given stream underStream will become the next layer down in the stack of streams.

The parameter small should be set to YES if the bzlib library should try to conserve memory. All other initializers set this value to NO.

Exceptions:
OLInputOutputException if the stream cannot be created for inflation
Parameters:
underStream the stream from which to read data
size the buffer size
small should be YES if the library should try to conserve memory, NO otherwise
Returns:
a reference to this stream

- (unsigned) readBytes: (uint8_t *)  dest
count: (unsigned)  max 

Read a sequence of bytes from the stream.

Bytes are decompressed up to the value of max and the number decompressed is returned. If no more bytes are available from the stream, then UINT_MAX is returned.

Exceptions:
OLInputOutputException if there is an error reading from the stream
Parameters:
dest the address to which the bytes should be read
max the maximum number bytes that should be read
Returns:
the number of bytes read or UINT_MAX if no bytes could be read

Reimplemented from OLLayeredInStream.

+ (id) streamWithInStream: (OLInStream *)  underStream  

Create and return a newly created stream.

The stream is created with a buffer size of 1,024. The given stream underStream will become the next layer down in the stack of streams.

Note:
If OpenStep is present the returned object will be autoreleased before being returned.
Exceptions:
OLInputOutputException if the stream cannot be created for inflation
Parameters:
underStream the stream from which to read data
Returns:
a reference to a newly created stream


Member Data Documentation

- (uint8_t*) buffer [protected]

The buffer required by bzlib.

- (unsigned) bufferSize [protected]

The size of the bzlib 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