#import <ObjectiveLib/GzipInStream.h>
Inheritance diagram for OLGzipInStream:
Public Member Functions | |
(const char *) | - comment |
Return the comment in the gzip data. | |
(const uint8_t *) | - extraField:count: |
Return an extra field. | |
(void) | - freeStreamResources |
Free the stream's resources. | |
(uint32_t) | - modificationTime |
Return the modification time embedded in the data. | |
(const char *) | - originalFileName |
Return the original file name associated with the data. | |
(unsigned) | - readBytes:count: |
Read a sequence of bytes from the stream. | |
Initializers and Deallocators | |
(id) | - initWithInStream:bufferSize:readZlibHeader: |
Initialize the stream. | |
Static Public Member Functions | |
(id) | + streamWithInStream: |
Create and return a newly created stream. | |
Protected Attributes | |
char * | comment |
The gzip comment. | |
uint32_t | crc |
The CRC-32 of the data. | |
BOOL | endOfStream |
Whether we have reached the end of the stream. | |
OLMap * | extraFields |
The extra fields. | |
char * | fileName |
The original file name. | |
uint32_t | modTime |
The modification time of the original file. |
The data are read as if they were written with the format specified in RFC 1952. The command-line tool gzip
writes data in this format, so this class can be used to read files written by gzip
.
- (const char*) comment |
Return the comment in the gzip data.
If the data contains no comment, then nil
is returned.
nil
if there is no comment - (const uint8_t*) extraField: | (const char *) | identifier | ||
count: | (unsigned *) | countOut | ||
Return an extra field.
Extra fields are identified by a two-letter identifier. If the requested extra field does not exist in the gzip data, then NULL
is returned.
OLInputOutputException | if the length of identifier is not equal to 2 |
identifier | the identifier of the extra field | |
countOut | a pointer to a unsigned int that will contain the length of the extra field's data on exit, or zero if no extra field with the given identifier can be found |
nil
if the extra field does not exist in the 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 OLZlibInStream.
- (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.
OLInputOutputException | if the stream cannot be created for inflation |
underStream | the stream from which to read data | |
size | the buffer size | |
zlibHeader | it doesn't matter what you use for this, as it will be overriden |
Reimplemented from OLZlibInStream.
- (uint32_t) modificationTime |
Return the modification time embedded in the data.
This is expressed in Unix format, which is the number of seconds since 00:00:00 GMT, Jan. 1, 1970. If no modification time was available when the data were created, then 0 is returned.
- (const char*) originalFileName |
Return the original file name associated with the data.
If no file name was recorded in the data, then nil
is returned.
nil
if no file name is present in the data - (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.
OLInputOutputException | if there is an error reading from the stream |
dest | the address to which the bytes should be read | |
max | the maximum number bytes that should be read |
Reimplemented from OLZlibInStream.
+ (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.
OLInputOutputException | if the stream cannot be created for inflation |
underStream | the stream from which to read data |
Reimplemented from OLZlibInStream.
- (char*) comment [protected] |
The gzip comment.
- (uint32_t) crc [protected] |
The CRC-32 of the data.
- (BOOL) endOfStream [protected] |
Whether we have reached the end of the stream.
- (OLMap*) extraFields [protected] |
The extra fields.
- (char*) fileName [protected] |
The original file name.
- (uint32_t) modTime [protected] |
The modification time of the original file.
|