artefaktur
software engineer &        architecture

 
 
 
 

class File

Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::io::File Class Reference

#include <File.h>

Inheritance diagram for acdk::io::File:

acdk::lang::Object acdk::io::Serializable acdk::lang::Comparable acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch acdk::io::MemoryMappedFile List of all members.

Detailed Description

The File class is a fassade to a virtual filesystem.

The implementation of a File should implement the FileImpl interface.

Please refer also to  acdk::io::FileSystem.

Author:
Roger Rene Kommer (mailto:kommer@artefaktur.com)
Version:
Revision
1.30
Date:
Date
2005/04/09 19:26:44
See also:
FileImpl FileSystem


Public Member Functions

 File (IN(RFileImpl) fileimpl)
 File (IN(RString) path)
 File (IN(RFile) parent, IN(RString) child)
 File (IN(RString) parent, IN(RString) child)
RFileImpl getFileImpl ()
virtual RFile makeChild (RString subfile)
virtual int compareTo (IN(acdk::lang::Object) o)
virtual int compareTo (IN(RFile) o)
virtual bool equals (IN(acdk::lang::Object) o)
 Normally check for equality (not identity) Object::equals() is true only if both objects are the same instance.

virtual int hashCode ()
RString getCanonicalPath ()
 API: JDK.

RString getAbsolutePath ()
 API: JDK.

RString getName ()
 API: JDK.

RString getParent ()
 API: JDK.

RFile getParentFile ()
 API: JDK.

RString getPath ()
 API: JDK.

bool isAbsolute ()
 API: JDK.

bool exists ()
 API: JDK.

bool canRead ()
 API: JDK.

bool canWrite ()
 API: JDK.

bool isDirectory ()
 API: JDK.

bool isFile ()
 API: JDK.

bool isHidden ()
 API: JDK.

jlong length ()
 API: JDK.

bool createNewFile ()
 API: JDK.

bool deleteFile ()
 API: like JDK in java the method is named as delete.

void deleteOnExit ()
RStringArray list (IN(RFilenameFilter) filter=Nil, int listFlags=FileListBoth)
 return the filename matching

RFileArray listFiles (IN(RFileFilter) filter=Nil, int listFlags=FileListBoth)
jlong lastModified ()
 API: JDK Status: not implemented.

jlong fileCreated ()
 API: enhanced Status: not tested.

bool mkdir (int mode=0777)
 mode is the file access bit mask.

bool mkdirs (int mode=0777)
 try to make directories recursive

bool renameTo (IN(RFile) dest)
 rename the file.

bool setLastModified (jlong time)
bool setFileCreated (jlong time)
bool setReadOnly (bool doReadOnly)
 set the file read only or read/write

bool setFileAttributes (int mask, int flags)
 set the file attribute flags

virtual RFileInfo getFileInfo ()
 return the cached file information for this file

RString toString ()
 return a string representation of this object Object::toString() return getName() by default

virtual RReader getReader ()
 return a reader of this file

virtual RWriter getWriter ()
 return a writer of this file

RString loadAscii ()
 reads the complete file into a String API: ACDK

RbyteArray loadBinary ()
 reads the complete file into a ByteArray API: ACDK


Static Public Member Functions

acdk::lang::Object create_instance ()
RFileImpl getFileImpl (IN(RString) fname)
char pathSeparatorChar ()
 return the seperator for PATH declarations on Windows this is ';' on unices it is ':'

RString pathSeparator ()
 return the seperator for PATH declarations on Windows this is ';' on unices it is ':'

char separatorChar ()
RString separator ()
RString endOfLine ()
RFileArray listRoots ()
 return the 'roots' of the file system.

RFile createTempFile (IN(RString) prefix, IN(RString) suffix)
 API: JDK.

RFile createTempFile (IN(RString) prefix, IN(RString) suffix, IN(RFile) directory)
 API: JDK.

RString getCWD ()
 return the current working directory

RFile getCWDFile ()
 return the current working directory

bool setCWD (IN(RString) newpath)
 set a new working directory

RString concat (IN(RString) parent, IN(RString) child)
 Merges parent and child path.


Protected Attributes

RFileImpl _fileImpl

Static Protected Attributes

const char _pathSeparatorChar
const char _nameSeparatorChar

Constructor & Destructor Documentation

acdk::io::File::File IN(RFileImpl fileimpl  )  [inline]
 

acdk::io::File::File IN(RString path  ) 
 

acdk::io::File::File IN(RFile parent,
IN(RString child
 

acdk::io::File::File IN(RString parent,
IN(RString child
 


Member Function Documentation

bool acdk::io::File::canRead  )  [inline]
 

API: JDK.

bool acdk::io::File::canWrite  )  [inline]
 

API: JDK.

virtual int acdk::io::File::compareTo IN(RFile o  )  [virtual]
 

virtual int acdk::io::File::compareTo IN(acdk::lang::Object o  )  [virtual]
 

Implements acdk::lang::Comparable.

RString acdk::io::File::concat IN(RString parent,
IN(RString child
[static]
 

Merges parent and child path.

API: extended

Parameters:
parent parent path element ('/usr/opt', 'c:\files\project')
child child path element ('local/myapp', 'myproject\doc')
Returns:
the concated string ('/usr/opt/local/myapp', 'c:\files\project\myproject\doc')

acdk::lang::Object acdk::io::File::create_instance  )  [inline, static]
 

Reimplemented from acdk::lang::Object.

bool acdk::io::File::createNewFile  )  [inline]
 

API: JDK.

RFile acdk::io::File::createTempFile IN(RString prefix,
IN(RString suffix,
IN(RFile directory
[static]
 

API: JDK.

RFile acdk::io::File::createTempFile IN(RString prefix,
IN(RString suffix
[static]
 

API: JDK.

bool acdk::io::File::deleteFile  )  [inline]
 

API: like JDK in java the method is named as delete.

void acdk::io::File::deleteOnExit  ) 
 

Todo:
File::deleteOnExit not supported yet

RString acdk::io::File::endOfLine  )  [static]
 

virtual bool acdk::io::File::equals IN(acdk::lang::Object o  )  [virtual]
 

Normally check for equality (not identity) Object::equals() is true only if both objects are the same instance.

See also:
serialized_equals()

Reimplemented from acdk::lang::Object.

bool acdk::io::File::exists  )  [inline]
 

API: JDK.

jlong acdk::io::File::fileCreated  )  [inline]
 

API: enhanced Status: not tested.

RString acdk::io::File::getAbsolutePath  )  [inline]
 

API: JDK.

RString acdk::io::File::getCanonicalPath  )  [inline]
 

API: JDK.

RString acdk::io::File::getCWD  )  [static]
 

return the current working directory

RFile acdk::io::File::getCWDFile  )  [static]
 

return the current working directory

RFileImpl acdk::io::File::getFileImpl  )  [inline]
 

RFileImpl acdk::io::File::getFileImpl IN(RString fname  )  [static]
 

virtual RFileInfo acdk::io::File::getFileInfo  )  [inline, virtual]
 

return the cached file information for this file

RString acdk::io::File::getName  )  [inline, virtual]
 

API: JDK.

Reimplemented from acdk::lang::Object.

RString acdk::io::File::getParent  )  [inline]
 

API: JDK.

RFile acdk::io::File::getParentFile  )  [inline]
 

API: JDK.

RString acdk::io::File::getPath  )  [inline]
 

API: JDK.

virtual RReader acdk::io::File::getReader  )  [virtual]
 

return a reader of this file

virtual RWriter acdk::io::File::getWriter  )  [virtual]
 

return a writer of this file

virtual int acdk::io::File::hashCode  )  [virtual]
 

See also:
serialized_hashCode

Reimplemented from acdk::lang::Object.

bool acdk::io::File::isAbsolute  )  [inline]
 

API: JDK.

bool acdk::io::File::isDirectory  )  [inline]
 

API: JDK.

bool acdk::io::File::isFile  )  [inline]
 

API: JDK.

bool acdk::io::File::isHidden  )  [inline]
 

API: JDK.

jlong acdk::io::File::lastModified  )  [inline]
 

API: JDK Status: not implemented.

jlong acdk::io::File::length  )  [inline]
 

API: JDK.

RStringArray acdk::io::File::list IN(RFilenameFilter filter = Nil,
int  listFlags = FileListBoth
[inline]
 

return the filename matching

Parameters:
filter if filter is Nil return all found files
listFlags combination of FileListFlags if listFlags has FileListRecursive the returned names are relative to this File

RFileArray acdk::io::File::listFiles IN(RFileFilter filter = Nil,
int  listFlags = FileListBoth
[inline]
 

RFileArray acdk::io::File::listRoots  )  [static]
 

return the 'roots' of the file system.

On Windows all mapped drives and on unices simply '/'

RString acdk::io::File::loadAscii  ) 
 

reads the complete file into a String API: ACDK

RbyteArray acdk::io::File::loadBinary  ) 
 

reads the complete file into a ByteArray API: ACDK

virtual RFile acdk::io::File::makeChild RString  subfile  )  [inline, virtual]
 

bool acdk::io::File::mkdir int  mode = 0777  )  [inline]
 

mode is the file access bit mask.

On non Unix platforms it will be ignored.

bool acdk::io::File::mkdirs int  mode = 0777  ) 
 

try to make directories recursive

RString acdk::io::File::pathSeparator  )  [static]
 

return the seperator for PATH declarations on Windows this is ';' on unices it is ':'

char acdk::io::File::pathSeparatorChar  )  [inline, static]
 

return the seperator for PATH declarations on Windows this is ';' on unices it is ':'

bool acdk::io::File::renameTo IN(RFile dest  )  [inline]
 

rename the file.

If rename success this File doesn't exists any more

RString acdk::io::File::separator  )  [static]
 

char acdk::io::File::separatorChar  )  [inline, static]
 

bool acdk::io::File::setCWD IN(RString newpath  )  [static]
 

set a new working directory

Returns:
false if new directory doesn't exists

bool acdk::io::File::setFileAttributes int  mask,
int  flags
[inline]
 

set the file attribute flags

Parameters:
mask mask which flags should be set, bit combination FileInfoFlags
flags flags to set, bit combination FileInfoFlags
Returns:
true on success

bool acdk::io::File::setFileCreated jlong  time  )  [inline]
 

bool acdk::io::File::setLastModified jlong  time  )  [inline]
 

bool acdk::io::File::setReadOnly bool  doReadOnly  )  [inline]
 

set the file read only or read/write

Returns:
true on success

RString acdk::io::File::toString  )  [virtual]
 

return a string representation of this object Object::toString() return getName() by default

Reimplemented from acdk::lang::Object.


Member Data Documentation

RFileImpl acdk::io::File::_fileImpl [protected]
 

const char acdk::io::File::_nameSeparatorChar [static, protected]
 

const char acdk::io::File::_pathSeparatorChar [static, protected]
 

 
Last modified 2005-05-08 18:32 by SYSTEM By Artefaktur, Ing. Bureau Kommer