- Inherits from:
- Object
- Conforms to:
- DDataReadable, DDataWritable, DTextReadable, DTextWritable
- Declared in:
- DBZipFile.h
Object
|
+---DBZipFile
Class Description
The DBZipFile class implements a number of methods for opening of, writing to,
reading from and closing of bzip2 files. See the open method for used settings for
the bzip2 library.
- Last modified:
- 23-Jul-2006 (DBZipFile.h)
Instance Variables
- private void *_file
- the file pointer
- private void *_bzfile
- the bzip file pointer
- private BOOL _read
- is the file opened for reading ?
- private BOOL _eof
- is end of file reached
- private int _error
- the reported error
- Constructors
- - (DBZipFile *) init
- Initialise an empty file object
- Returns:
- the object
- - (DBZipFile *) init :(const char *) name :(const char *) mode
- Open a bzip file with default level and strategy
- Parameters:
- name - the filename (with extension .bz2)
mode - the file mode (r,w)
- Returns:
- the object
- - (DBZipFile *) init :(const char *) name :(const char *) mode :(BOOL) small
- Open a bzip file
- Parameters:
- name - the filename (with extension .bz2)
mode - the file mode (r,w)
small - should a small memory footprint be used
- 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 bzip file with big memory usage
- Parameters:
- name - the filename (with extension .bz2)
mode - the file mode (r,w)
- Returns:
- is the file open ?
- - (BOOL) open :(const char *) name :(const char *) mode :(BOOL) small
- Open a bzip file (note: the defaults for the bzip2 library: verbosity = 0 (silent), workFactor = 0,
blockSize100k = 5 (for small) and 9 (for not small)
- Parameters:
- name - the filename (with extension .bz2)
mode - the file mode (r,w)
small - should a small memory footprint be used ?
- Returns:
- is the file open ?
- TextReadable protocol implementation
- - (BOOL) isEof
- Check if the end of the bzip2 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
- Returns:
- NO (not implemented)
- - (BOOL) skip :(unsigned long) offset
- Skip a number of positions
- Parameters:
- offset - the number of bytes to skip
- Returns:
- NO (not implemented)
- - (unsigned long) tell
- Tell the current position in the readable
- Returns:
- -1 (not implemented)
- 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:
- a (new) data string object
- - (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 *) data :(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:
- NO (not implemented for BZipFile)
- File closing methods
- - (DBZipFile *) close
- Close the file
- Returns:
- the file object
generated 25-Jul-2006 by ObjcDoc 3.0.0