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

A stream for zlib decompression. More...

#import <ObjectiveLib/ZlibInStream.h>

Inheritance diagram for OLZlibInStream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(void) - close
 Close the stream.
(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:readZlibHeader:
 Initialize the stream.
(void) - dealloc
 Finalize the stream and deallocate any allocated memory.

Static Public Member Functions

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

Protected Attributes

uint8_t * buffer
 The buffer required by zlib.
unsigned bufferSize
 The size of the zlib buffer.
struct z_stream_s * zstream
 The opaque data type used by zlib to represent the stream.

Detailed Description

A stream for zlib decompression.

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

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:
OLInputOutputExceptionif there is an error closing the stream

Reimplemented from OLLayeredInStream.

- (void) dealloc

Finalize the stream and deallocate any allocated memory.

Reimplemented from OLLayeredInStream.

Reimplemented in OLGzipInStream.

- (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:
OLInputOutputExceptionif the stream cannot be created for inflation
Parameters:
underStreamthe 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:
OLInputOutputExceptionif the stream cannot be created for inflation
Parameters:
underStreamthe stream from which to read data
sizethe buffer size
Returns:
a reference to this stream
- (id) initWithInStream: (OLInStream *)  underStream
bufferSize: (unsigned)  size
readZlibHeader: (BOOL)  zlibHeader 

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. If zlibHeader is YES, then the stream will attempt to read the zlib header.

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.
Exceptions:
OLInputOutputExceptionif the stream cannot be created for inflation
Parameters:
underStreamthe stream from which to read data
sizethe buffer size
zlibHeadershould be YES if the zlib header should be read from the stream, otherwise NO
Returns:
a reference to this stream

Reimplemented in OLGzipInStream.

- (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:
OLInputOutputExceptionif there is an error reading from the stream
Parameters:
destthe address to which the bytes should be read
maxthe 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.

Reimplemented in OLGzipInStream.

+ (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:
OLInputOutputExceptionif the stream cannot be created for inflation
Parameters:
underStreamthe stream from which to read data
Returns:
a reference to a newly created stream

Reimplemented in OLGzipInStream.


Member Data Documentation

- (uint8_t*) buffer [protected]

The buffer required by zlib.

- (unsigned) bufferSize [protected]

The size of the zlib buffer.

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