- Inherits from:
- Object
- Conforms to:
- DDataReadable, DDataWritable, DTextReadable, DTextWritable
- Declared in:
- DGZipFile.h
Object
|
+---DGZipFile
Class Description
The DGZipFile class implements a number of methods for opening of, writing to,
reading from and closing of gzip files.
- Last modified:
- 31-Oct-2007 (DGZipFile.h)
Instance Variables
- private void *_file
- the file pointer
- Constructors
- - (DGZipFile *) init
- Initialise an empty file object
- Returns:
- the object
- - (DGZipFile *) init :(const char *) name :(const char *) mode
- Open a gzip file with default level and strategy
- Parameters:
- name - the filename (with extension .gz)
mode - the file mode (r,w)
- Returns:
- the object
- - (DGZipFile *) init :(const char *) name :(const char *) mode :(int) level :(int) strategy
- Open a gzip file
- Parameters:
- name - the filename (with extension .gz)
mode - the file mode (r,w)
level - the level of compression
strategy - the strategy of compression
- Returns:
- the object
- Copy related methods
- - shallowCopy
- Do a shallow copy of the object (not implemented)
- Returns:
- the object
- Deconstructor
- - free
- Free the object
- Returns:
- the file object
- File info methods
- - (int) error
- Return the last error
- Returns:
- the last error
- - (BOOL) isOpen
- Check if the file is open
- Returns:
- is the file open ?
- File opening methods
- - (BOOL) open :(const char *) name :(const char *) mode
- Open a gzip file with default level and strategy
- Parameters:
- name - the filename (with extension .gz)
mode - the file mode (r,w)
- Returns:
- is the file open ?
- - (BOOL) open :(const char *) name :(const char *) mode :(int) level :(int) strategy
- Open a gzip file with a level and strategy (note: only output files)
- Parameters:
- name - the filename (with extension .gz)
mode - the file mode (w)
level - the level of compression (0 = none..9 = max,slow)
strategy - the strategy of compression (see DGZ..)
- Returns:
- is the file open ?
- TextReadable protocol implementation
- - (BOOL) isEof
- Check if the end of the gzip file is reached
- Returns:
- is it?
- - (char) readChar
- Read a character
- Returns:
- the character read (EOS for EOF)
- - (DText *) readLine
- Read a line of text (till Eof or \n)
- Returns:
- a (new) text string (or nil for no data)
- - (DText *) readText
- Read a text string (all available text)
- Returns:
- a (new) text string
- - (DText *) readText :(long) length
- Read a text string
- Parameters:
- length - the length of the text to be read
- Returns:
- a (new) text string
- - (BOOL) seek :(unsigned long) offset :(int) origin
- Move the current position in the readable
- Parameters:
- offset - the offset from the origin (in bytes)
origin - the origin for the offset (see DGZ_SEEK..)
- Returns:
- success
- - (BOOL) skip :(unsigned long) offset
- Skip a number of positions
- Parameters:
- offset - the number of bytes to skip
- Returns:
- success
- - (unsigned long) tell
- Tell the current position in the readable
- Returns:
- the current position (or -1 for error)
- Implementation of DTextWritable
- - (BOOL) writeChar :(char) ch
- Write a character
- Parameters:
- ch - the character to be written
- Returns:
- success
- - (BOOL) writeLine :(const char *) text
- Write line (appending a '\n')
- Parameters:
- text - the text to be written
- Returns:
- success
- - (BOOL) writeText :(const char *) text
- Write text string
- Parameters:
- text - the text to be written
- Returns:
- success
- Methods for DDataReadable protocol
- - (unsigned char) readByte
- Read a byte
- Returns:
- the byte read (0 for error)
- - (DData *) readData :(unsigned long) length
- Read a data string
- Parameters:
- length - the length of the data
- Returns:
- the object
- - (unsigned long) readData :(unsigned char *) dest :(unsigned long) length
- Read a data string
- Parameters:
- dest - the destination buffer
length - the length of the data (and minimum size of dest)
- Returns:
- the actual number of bytes read
- - (double) readDouble
- Read a double
- Returns:
- the double
- - (long) readLong
- Read a long
- Returns:
- the long
- - (short) readShort
- Read a short
- Returns:
- the short
- DDataWritable protocol implementation
- - (BOOL) writeByte :(unsigned char) byte
- Write a byte
- Parameters:
- byte - the byte to be written
- Returns:
- success
- - (BOOL) writeData :(const unsigned char *) text :(unsigned long) length
- Write a data string
- Parameters:
- data - the data to be written
length - the length of the data
- Returns:
- success
- - (BOOL) writeDouble :(double) nr
- Write a double
- Parameters:
- nr - the double to be written
- Returns:
- success
- - (BOOL) writeLong :(long) nr
- Write a long
- Parameters:
- nr - the long to be written
- Returns:
- success
- - (BOOL) writeShort :(short) nr
- Write a short
- Parameters:
- nr - the short to be written
- Returns:
- success
- List related methods
- - (DList *) readLines
- Read all lines from a file into a list of strings
- Returns:
- a (new) list of (new) DText objects
- - (BOOL) writeLines :(DList *) list
- Writes all the elements ('lines') of text from a list to file
- Parameters:
- list - the list with objects that responds to textable protocol
- Returns:
- success
- File manipulation
- - (BOOL) flush
- Flush the output buffers of the file
- Returns:
- success
- File closing methods
- - (DGZipFile *) close
- Close the file
- Returns:
- the file object
generated 05-Nov-2007 by ObjcDoc 3.0.0