Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

File Class Reference
[System]

#include <OpenMS/SYSTEM/File.h>

List of all members.


Detailed Description

Basic file handling operations.

Static Public Member Functions

static bool exists (const String &file)
 Method used to test if a file exists.
static bool empty (const String &file)
 Return true if the file does not exist of the file is empty.
static bool remove (const String &file)
 Removes a file (if it exists).
static void absolutePath (String &file)
 Replaces the relative path in the argument with the absolute path.
static String basename (const String &file)
 Returns the basename of the file (without the path).
static String path (const String &file)
 Returns the path of the file (without the file name).
static bool readable (const String &file)
 Return true if the file exists and is readable.
static bool writable (const String &file)
 Return true if the file is writable.
static String find (const String &filename, std::vector< String > directories=std::vector< String >())
 Looks up the location of filename.
static bool fileList (const String &dir, const String &file_pattern, std::vector< String > &output)
 Retrieves a list of files matching file_pattern in directory dir.
static String getUniqueName ()
 Returns a string, consisting of date, time, hostname, process id, and a incrementing number. This can be used for temporary files.
static bool createSparseFile (const String &filename, const Offset64Int &filesize)
 Creates a sparse file filename of size filesize bytes.
static bool extendSparseFile (const int &hFile, const Offset64Int &filesize)
 Extends a sparse file with handle hFile to size filesize bytes.
static int getSwapFileHandle (const String &filename, const Offset64Int &filesize, const bool &create)
 get a handle to a sparse file filename with size filesize to used for swap
static void closeSwapFileHandle (const int &f_handle)
 close handle to a swap file

Member Function Documentation

static bool exists ( const String file  )  [static]

Method used to test if a file exists.

static bool empty ( const String file  )  [static]

Return true if the file does not exist of the file is empty.

static bool remove ( const String file  )  [static]

Removes a file (if it exists).

Returns:
Returns true if the file was successfully deleted (or if it did not exist).

static void absolutePath ( String file  )  [static]

Replaces the relative path in the argument with the absolute path.

static String basename ( const String file  )  [static]

Returns the basename of the file (without the path).

static String path ( const String file  )  [static]

Returns the path of the file (without the file name).

static bool readable ( const String file  )  [static]

Return true if the file exists and is readable.

static bool writable ( const String file  )  [static]

Return true if the file is writable.

static String find ( const String filename,
std::vector< String directories = std::vector< String >() 
) [static]

Looks up the location of filename.

First the directories in directories are cheched, then the 'data' directory of the environment variable $OPENMS_DATA_PATH is checked, at last the 'data' directory of the OpenMS built directory is checked.

If the file is not found there, an empty string is returned.

static bool fileList ( const String dir,
const String file_pattern,
std::vector< String > &  output 
) [static]

Retrieves a list of files matching file_pattern in directory dir.

Returns:
true => there are matching files

static String getUniqueName (  )  [static]

Returns a string, consisting of date, time, hostname, process id, and a incrementing number. This can be used for temporary files.

static bool createSparseFile ( const String filename,
const Offset64Int filesize 
) [static]

Creates a sparse file filename of size filesize bytes.

Creates a sparse* file filename (*requires Filesystem support!) of size filesize bytes using platform specific fileIO The function is using 64-bit fileoffsets automatically (and is therefore independent of compiler flags)

static bool extendSparseFile ( const int &  hFile,
const Offset64Int filesize 
) [static]

Extends a sparse file with handle hFile to size filesize bytes.

Extends a sparse* file with handle hFile (*requires Filesystem support!) to size filesize bytes using platform specific fileIO The function is using 64-bit fileoffsets automatically (and is therefore independent of compiler flags)

static int getSwapFileHandle ( const String filename,
const Offset64Int filesize,
const bool &  create 
) [static]

get a handle to a sparse file filename with size filesize to used for swap

The file can be created (create) if necessary

Returns:
handle to a file (which is created if necessary)
Exceptions:
exception on failure to acquire the handle (to make cross platform error handling easy)
Note:
implementation is platform dependent, as handles in Windows are void* vs. int in Unix

static void closeSwapFileHandle ( const int &  f_handle  )  [static]

close handle to a swap file


The documentation for this class was generated from the following file:
Generated Tue Apr 1 15:36:47 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1