Class DBZipFile

Inherits from:
Object
Conforms to:
DDataReadable, DDataWritable, DTextReadable, DTextWritable
Declared in:
DBZipFile.h

Class Hierarchy

    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.

Example:
#include <stdio.h>
#include "ofc/DBZipFile.h"

int main(int argc, char *argv[])
{
  DBZipFile *file = [DBZipFile new];
  DText     *str;

  char       name[] = "output.bz2";

  if ([file open :name :"w"])          // Open a bzipped text file for writing
  {
    if (![file writeLine :"A line full of text .."])
      printf("\"%s\" could not be written: %d\n", name, [file error]);

    [file close];

    printf("\"%s\" succesfull written.\n", name);
  }
  else
    printf("\"%s\" could not be opened: %d\n", name, [file error]);


  if ([file open :name :"r"])          // Open a bzipped text file for reading
  {
    while (![file isEof])                // Read all lines
    {
      str = [file readLine];

      printf("%s\n", [str cstring]);

      [str free];
    }

    [file close];

    printf("\"%s\" succesfull read.\n", name);
  }
  else
    printf("\"%s\" could not be opened: %d\n", name, [file error]);

  [file free];

  return 0;
}
Last modified:
25-Aug-2008 (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

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0