Project CASUAL
API for CASUAL
 All Classes Namespaces Functions Variables
Public Member Functions | List of all members
CASUAL.FileOperations Class Reference

Public Member Functions

 FileOperations ()
 
void recursiveDelete (String path)
 
void recursiveDelete (File path)
 
boolean verifyWritePermissionsRecursive (String path)
 
String findRecursive (String PathToSearch, String FileName)
 
boolean verifyExists (String file)
 
boolean makeFolder (String Folder)
 
void writeStreamToFile (BufferedInputStream stream, String destination) throws FileNotFoundException, IOException
 
void writeToFile (String Text, String File) throws IOException
 
void overwriteFile (String Text, String File) throws IOException
 
Boolean deleteFile (String FileName)
 
boolean deleteStringArrayOfFiles (String[] cleanUp)
 
void copyFile (File sourceFile, File destFile) throws IOException
 
String currentDir ()
 
boolean copyFile (String FromFile, String ToFile)
 
boolean setExecutableBit (String Executable)
 
boolean verifyResource (String res)
 
String readTextFromResource (String Resource)
 
String readTextFromStream (BufferedInputStream in)
 
String readFile (String FileOnDisk)
 
String[] listFolderFiles (String folder)
 
String[] listFolderFilesCannonically (String folder)
 
ArrayList< String > listRecursive (String folder)
 
boolean moveFile (File sourceFile, File destFile) throws IOException
 
boolean moveFile (String sourceFile, String destFile) throws IOException
 

Detailed Description

FileOperations provides a set of acellerators for working with files in Java.

Author
Adam Outler adamo.nosp@m.utle.nosp@m.r@gma.nosp@m.il.c.nosp@m.om

Constructor & Destructor Documentation

CASUAL.FileOperations.FileOperations ( )

performs file operations

Member Function Documentation

void CASUAL.FileOperations.copyFile ( File  sourceFile,
File  destFile 
) throws IOException

copies a file from a source to a destination

Parameters
sourceFilefile to copy
destFiledestination to copy file (including filename)
Exceptions
IOExceptionwhen permission problem exists
boolean CASUAL.FileOperations.copyFile ( String  FromFile,
String  ToFile 
)

copies a file from a string path to a string path returns a boolean if completed

Parameters
FromFilefile to copy
ToFiledestination to copy to
Returns
true if completed
String CASUAL.FileOperations.currentDir ( )

returns the name of the current folder

Returns
current folder
Boolean CASUAL.FileOperations.deleteFile ( String  FileName)

takes a string filename returns a boolean if the file was deleted

Parameters
FileNamefilename to delete
Returns
true if file was deleted
boolean CASUAL.FileOperations.deleteStringArrayOfFiles ( String[]  cleanUp)

deletes files

Parameters
cleanUpfiles to be deleted
Returns
true if all files were deleted false and halts on error
String CASUAL.FileOperations.findRecursive ( String  PathToSearch,
String  FileName 
)

takes a path and a name returns qualified path to file

Parameters
PathToSearchpath to search
FileNamefilename to locate
Returns
absolute path to folder
String [] CASUAL.FileOperations.listFolderFiles ( String  folder)

lists files in a folder

Parameters
folderfolder to list
Returns
array of filenames
String [] CASUAL.FileOperations.listFolderFilesCannonically ( String  folder)

lists files with full qualifiers

Parameters
folderfolder to list
Returns
array of files
boolean CASUAL.FileOperations.makeFolder ( String  Folder)

makes a folder, works recursively

Parameters
Folderfolder to create
Returns
true if folder was created
boolean CASUAL.FileOperations.moveFile ( File  sourceFile,
File  destFile 
) throws IOException
Parameters
sourceFilefrom locaton
destFileto location
Returns
true if moved
Exceptions
IOExceptionwhen permission problem exists
boolean CASUAL.FileOperations.moveFile ( String  sourceFile,
String  destFile 
) throws IOException

moves a file

Parameters
sourceFilefrom location
destFileto location
Returns
true if moved
Exceptions
IOExceptionwhen permissions problems exist
void CASUAL.FileOperations.overwriteFile ( String  Text,
String  File 
) throws IOException

takes a string and a filename, overwrites to the file

Parameters
Texttext to write
Filefile to write to
Exceptions
IOExceptionwhen permission problems exist
String CASUAL.FileOperations.readFile ( String  FileOnDisk)

reads file contents returns string

Parameters
FileOnDiskfile to read
Returns
string representation of file
String CASUAL.FileOperations.readTextFromResource ( String  Resource)

takes a resource name returns a string of file contents

Parameters
Resourcepath to resource in jar or filesystem
Returns
string contents of resource
String CASUAL.FileOperations.readTextFromStream ( BufferedInputStream  in)

reads text from stream

Parameters
instream to read
Returns
text output
void CASUAL.FileOperations.recursiveDelete ( String  path)

recursively deletes a String path

Parameters
pathpath to delete recursively
void CASUAL.FileOperations.recursiveDelete ( File  path)

recursively deletes a file path

Parameters
pathpath to delete
boolean CASUAL.FileOperations.setExecutableBit ( String  Executable)

takes a filename sets executable returns result

Parameters
Executablefile to be set executable on linux/mac/unix
Returns
true if executable bit was set
boolean CASUAL.FileOperations.verifyExists ( String  file)

verifies file/folder exists returns a boolean value if the file exists

Parameters
filefile to check
Returns
true if exists
boolean CASUAL.FileOperations.verifyResource ( String  res)

takes a string resource name returns result if it exists

Parameters
resresource to verify
Returns
true if resource exists
boolean CASUAL.FileOperations.verifyWritePermissionsRecursive ( String  path)

verify ability to write to every file in a path

Parameters
pathpath to verify.
Returns
true if permission to write
void CASUAL.FileOperations.writeStreamToFile ( BufferedInputStream  stream,
String  destination 
) throws FileNotFoundException, IOException

writes a stream to a destination file

Parameters
streamStream to be written
destinationoutput file
Exceptions
FileNotFoundExceptionwhen destination cannot be created
IOExceptionwith permission problems
void CASUAL.FileOperations.writeToFile ( String  Text,
String  File 
) throws IOException

takes a string and a filename, writes to the file

Parameters
Texttext to write
Filefile to write to
Exceptions
IOExceptionwhen permission problems exist

The documentation for this class was generated from the following file: