DzGZFile Class Reference
[File Input and Output Objects]

DAZ Script *.gz (gzip) file I/O class. More...

Inheritance diagram for DzGZFile:

DzFileInfo List of all members.

Enumerations

enum  AccessMode {
  ReadOnly, WriteOnly, ReadWrite, Append,
  Truncate, Translate
}

Methods

void close ()
Boolean eof ()
Boolean open (Number accessMode)
String read ()
Number readByte ()
String readLine ()
Array readLines ()
Boolean unzip (String filename)
void write (String data, Number length=-1)
void writeByte (Number byte)
void writeLine (String data)
Boolean zip (String filename)

Constructors

 DzGZFile (String file)

Detailed Description

DAZ Script *.gz (gzip) file I/O class.

This class provides DAZ Script functionality for reading and writing *.gz ('gzipped') files. A high-level interface for zipping/unzipping files is provided with the functions zip() and unzip(). Also, a low-level interface is provided, allowing scripts to read and write compressed files directly.


Member Enumeration Documentation

enum DzGZFile::AccessMode

File access mode flags


Constructor & Destructor Documentation

DzGZFile::DzGZFile ( String  file  ) 

Create a file with the given file name


Member Function Documentation

void DzGZFile::close (  ) 

Close the file

Boolean DzGZFile::eof (  ) 

Returns:
true if the current file position is at the end of the file.

Boolean DzGZFile::open ( Number  accessMode  ) 

Open the file with the given mode.

Returns:
true if the file was opened successfully.

QString DzGZFile::read (  ) 

Read the entire file.

Returns:
The uncompressed file contents as a string.

int DzGZFile::readByte (  ) 

Read one uncompressed character from the file buffer.

Returns:
The next uncompressed character read from the file.

QString DzGZFile::readLine (  ) 

Read an uncompressed line of text from the file.

Returns:
The next uncompressed file line as a string.

QStringList DzGZFile::readLines (  ) 

Uncompress the entire file and split it into lines of text.

Returns:
An Array of uncompressed text lines from the file.

Boolean DzGZFile::unzip ( String  filename  ) 

Unzips this file into the given filename.

void DzGZFile::write ( String  data,
Number  length = -1 
)

Write a string to the file compression buffer.

Parameters:
data The string to write to the file.
length The maximum number of characters to write to the file. If this is less than 1, the whole string is written.

void DzGZFile::writeByte ( Number  byte  ) 

Write a single byte (character) to the file compression buffer.

Parameters:
byte The character to write to the file.

void DzGZFile::writeLine ( String  data  ) 

Write a line of text to the file compression buffer.

Parameters:
data The string to write to the file - a new line character will be written immediately following the string contents.

Boolean DzGZFile::zip ( String  filename  ) 

Replaces this file's contents with the zipped up contents of the given file. If this file does not exist, it will be created.


Generated on Thu Sep 24 12:21:12 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.