DzFile Class Reference
[File Input and Output Objects]

DAZ Script file I/O class. More...

Inheritance diagram for DzFile:

DzFileInfo List of all members.

Enumerations

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

Methods

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

Constructors

 DzFile (String file)

Detailed Description

DAZ Script file I/O class.

This class provides DAZ Script functionality for reading and writing files.


Member Enumeration Documentation

enum DzFile::AccessMode

File access mode flags

Enumerator:
ReadOnly  Open the file for reading only
WriteOnly  Open the file for writing only
ReadWrite  Open the file for reading and writing
Append  Open the file in append mode. Keep existing file contents and start with the file pointer at the end of the file.
Truncate  Truncates the file
Translate  Enables translation of carriage returns and linefeeds to the system native standard.


Constructor & Destructor Documentation

DzFile::DzFile ( String  file  ) 

Create a file with the given file name


Member Function Documentation

void DzFile::close (  ) 

Close the file

Boolean DzFile::copy ( String  newName  ) 

Parameters:
newName The path to copy this file to
Returns:
true if copying the file is successful; otherwise false.
Attention:
If newName already exists it will not be overwritten.

Boolean DzFile::eof (  ) 

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

Boolean DzFile::open ( Number  accessMode  ) 

Open the file with the given mode.

Returns:
true if the file was opened successfully.

QString DzFile::read (  ) 

Read the entire file.

Returns:
The file contents as a string.

int DzFile::readByte (  ) 

Read one character from the file.

Returns:
The character read from the file.

QString DzFile::readLine (  ) 

Read a line of text from the file.

Returns:
The file line as a string.

QStringList DzFile::readLines (  ) 

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

Returns:
An Array of lines from the file.

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

Write a string to the file.

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 DzFile::writeByte ( Number  byte  ) 

Write a single byte (character) to the file.

Parameters:
byte The character to write to the file.

void DzFile::writeLine ( String  data  ) 

Write a line to the file.

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


Generated on Thu Sep 24 12:21:12 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.