name.alessiosaltarin.utils
Class FileManager

java.lang.Object
  extended by name.alessiosaltarin.utils.FileManager

public final class FileManager
extends java.lang.Object

Saving/loading text files.

Since:
04/2001
Version:
1.2
Author:
Alessio Saltarin 2001/2002/2003

Method Summary
 boolean appendToFile(java.lang.String fileName, java.lang.String fileString)
          Appends contents to a file
 boolean copyFile(java.lang.String sourceFile, java.lang.String outputFile)
          Copy a file.
 boolean existFile(java.lang.String fileName)
          Checks if file exists
 java.lang.String getErrorMsg()
          Returns error message in case of error.
static FileManager getReference()
          Returns handle to the object (singleton)
static void main(java.lang.String[] args)
          Deprecated.  
 java.lang.String openFile(java.lang.String fileName)
          Contents of opened file as a string.
 boolean saveFile(java.lang.String fileName, java.lang.String fileString)
          Saves a string into a file.
 boolean saveFile(java.lang.String fileName, java.lang.String fileString, boolean append)
          Saves a string into a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getReference

public static FileManager getReference()
Returns handle to the object (singleton)

Returns:
FileManager reference

getErrorMsg

public java.lang.String getErrorMsg()
Returns error message in case of error.

Returns:
error message

openFile

public java.lang.String openFile(java.lang.String fileName)
Contents of opened file as a string.

Parameters:
fileName - complete path to file
Returns:
contents of the file

copyFile

public boolean copyFile(java.lang.String sourceFile,
                        java.lang.String outputFile)
Copy a file.

Parameters:
sourceFile - Full path to existing file
outputFile - Full path to file to be created
Returns:
true if file is successfully copied
Since:
September 2002

existFile

public boolean existFile(java.lang.String fileName)
Checks if file exists

Parameters:
fileName - complete path
Returns:
true if file exists

saveFile

public boolean saveFile(java.lang.String fileName,
                        java.lang.String fileString)
Saves a string into a file.

Parameters:
fileName - complete path to the new file
fileString - file contents
Returns:
true if saving was correctly done

saveFile

public boolean saveFile(java.lang.String fileName,
                        java.lang.String fileString,
                        boolean append)
Saves a string into a file.

Parameters:
fileName - complete path to the new file
fileString - file contents
append - true if you want to append to an existing file
Returns:
true if saving was correctly done

appendToFile

public boolean appendToFile(java.lang.String fileName,
                            java.lang.String fileString)
Appends contents to a file

Parameters:
fileName - complete path to the new file
fileString - file contents
Returns:
true if saving was correctly done

main

public static void main(java.lang.String[] args)
Deprecated. 

For test purposes, only

Parameters:
args - x

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net