#import <ObjecitveLib/GzipOutStream.h>
Inheritance diagram for OLGzipOutStream:
Public Member Functions | |
(void) | - addExtraField:withBytes:count: |
Add an extra field. | |
(void) | - close |
Close the stream. | |
(void) | - freeStreamResources |
Free the stream's resources. | |
(void) | - markModificationTime |
Set the modification time to now. | |
(void) | - setComment: |
Set the comment of the gzip data. | |
(void) | - setCommentText: |
Set the comment of the gzip data. | |
(void) | - setOriginalFileName:includeModificationTime: |
Set the original file name of the data. | |
(void) | - setOriginalFileNameText:includeModificationTime: |
Set the original file name of the data. | |
(unsigned) | - writeBytes:count: |
Write a sequence of bytes to the stream. | |
Initializers and Deallocators | |
(id) | - initWithOutStream:compressionLevel:bufferSize:writeZlibHeader: |
Initialize the compression stream. | |
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 * | commentData |
The gzip comment. | |
uint32_t | crc |
The CRC-32 value of the data. | |
OLDataOutStream * | extraFields |
The extra fields. | |
uint8_t * | fileNameData |
The original file name associated with the data. | |
BOOL | headerWritten |
Whether the header has been written. | |
uint32_t | modTime |
The modification time. | |
BOOL | trailerWritten |
Whether the trailer has been written. |
The data are written using the format described in RFC 1952, and can be read by the command-line tool gzip
.
- (void) addExtraField: | (const char *) | identifier | ||
withBytes: | (const uint8_t *) | buf | ||
count: | (unsigned) | num | ||
Add an extra field.
The bytes in buf are associated with identifier in the gzip data.
OLInputOutputException | if the length of identifier is not 2 |
identifier | the identifier of the extra field | |
buf | the bytes associated with the extra field | |
num | the number of bytes in buffer |
- (void) close |
Close the stream.
After receiving this message the stream will no longer be available for writing.
OLInputOutputException | if there is an error closing the stream |
Reimplemented from OLZlibOutStream.
- (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 OLZlibOutStream.
- (id) initWithOutStream: | (OLOutStream *) | underStream | ||
compressionLevel: | (int) | level | ||
bufferSize: | (unsigned) | size | ||
writeZlibHeader: | (BOOL) | zlibHeader | ||
Initialize the compression stream.
The 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.
OLInvalidArgumentException | if the compression level is not in the range [0,9] | |
OLInputOutputException | if the stream cannot be created for deflation |
underStream | the next lower stream in the stack | |
level | the compression level which must be in the range [0,9] | |
size | the size of the internal buffer | |
zlibHeader | it doesn't matter what you use, as it will be overridden |
Reimplemented from OLZlibOutStream.
- (void) markModificationTime |
Set the modification time to now.
This message should be sent if a modification time is desired, but there is no original file name in the data. The time is set to the current time.
- (void) setComment: | (const char *) | comment |
Set the comment of the gzip data.
The string comment is set as the data's comment.
If this message is sent after the first bytes have been written to the stream, then setting the comment will have no effect.
comment | the gzip data's new comment |
- (void) setCommentText: | (OLText *) | comment |
Set the comment of the gzip data.
The string comment is set as the data's comment.
comment | the gzip data's new comment |
- (void) setOriginalFileName: | (const char *) | name | ||
includeModificationTime: | (BOOL) | mtime | ||
Set the original file name of the data.
To preserve the original file name when the data are extracted this message can be sent. Also, to set the modification time of the original file name, the arguement mtime can be YES, in which case the modification time of the gzip stream will be set to the modification time of the file at name.
If this message is sent after the first bytes have been written to the stream, then setting the file name will have no effect.
name | the name of the original file | |
mtime | YES if the modification time should be set, NO otherwise |
- (void) setOriginalFileNameText: | (OLText *) | name | ||
includeModificationTime: | (BOOL) | mtime | ||
Set the original file name of the data.
To preserve the original file name when the data are extracted this message can be sent. Also, to set the modification time of the original file name, the arguement mtime can be YES, in which case the modification time of the gzip stream will be set to the modification time of the file at name.
name | the name of the original file | |
mtime | YES if the modification time should be set, NO otherwise |
+ (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.
OLInputOutputException | if the stream cannot be created for deflation |
underStream | the next lower stream in the stack |
Reimplemented from OLZlibOutStream.
+ (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.
OLInvalidArgumentException | if the compression level is not in the range [0,9] | |
OLInputOutputException | if the stream cannot be created for deflation |
underStream | the next lower stream in the stack | |
level | the compression level which must be in the range [0,9] |
Reimplemented from OLZlibOutStream.
- (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.
OLInputOutputException | if there is an error writing to the stream |
bytes | the bytes to write | |
num | the number of bytes to write |
Reimplemented from OLZlibOutStream.
- (uint8_t*) commentData [protected] |
The gzip comment.
- (uint32_t) crc [protected] |
The CRC-32 value of the data.
- (OLDataOutStream*) extraFields [protected] |
The extra fields.
- (uint8_t*) fileNameData [protected] |
The original file name associated with the data.
- (BOOL) headerWritten [protected] |
Whether the header has been written.
- (uint32_t) modTime [protected] |
The modification time.
- (BOOL) trailerWritten [protected] |
Whether the trailer has been written.
|