org.cementj.util
Class FileUtility

java.lang.Object
  extended by org.cementj.util.FileUtility

public class FileUtility
extends java.lang.Object

Collection of File-related utilities.

Copyright: Delta Vortex Technologies, 2002.


Field Summary
static java.lang.String FILE_SEPARATOR
          Convenience reference for the "file.separator" property from System.getProperties().
 
Constructor Summary
protected FileUtility()
           
 
Method Summary
static void createDirectory(java.lang.String dirName)
          Convenience one-liner to create a directory if the file doesn't exist.
static void purgeDirectory(java.io.File dir)
          Convenience one-liner to purge a directory including all files and subdirectories -- Use With Extreme Caution!
static void purgeDirectory(java.lang.String dirName)
          Convenience one-liner to purge a directory including all files and subdirectories -- Use With Extreme Caution!
static void purgeUnderlyingFiles(java.io.File dir, long updatedBeforeTime)
          Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!
static void purgeUnderlyingFiles(java.lang.String dirName, java.util.Date updatedBeforeDate)
          Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!
static void purgeUnderlyingFiles(java.lang.String dirName, java.util.GregorianCalendar updatedBeforeDate)
          Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!
static void purgeUnderlyingFiles(java.lang.String dirName, long updatedBeforeTime)
          Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!
static void saveFileToDisk(java.io.File file, byte[] contents)
          Convenience one-liner to save data to a specific file on Disk.
static void saveFileToDisk(java.io.File file, java.lang.String contents)
          Convenience one-liner to save data to a specific file on Disk.
static void saveFileToDisk(java.lang.String fileName, byte[] contents)
          Convenience one-liner to save data to a specific file on Disk.
static void saveFileToDisk(java.lang.String fileName, java.lang.String contents)
          Convenience one-liner to save data to a specific file on Disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SEPARATOR

public static final java.lang.String FILE_SEPARATOR
Convenience reference for the "file.separator" property from System.getProperties().

Since:
0.5
Constructor Detail

FileUtility

protected FileUtility()
Method Detail

saveFileToDisk

public static void saveFileToDisk(java.lang.String fileName,
                                  java.lang.String contents)
                           throws java.io.IOException
Convenience one-liner to save data to a specific file on Disk. Will abend if file already exists.

Parameters:
file - name
contents -
Throws:
java.io.IOException
Since:
0.5

saveFileToDisk

public static void saveFileToDisk(java.io.File file,
                                  java.lang.String contents)
                           throws java.io.IOException
Convenience one-liner to save data to a specific file on Disk. Will abend if file already exists.

Parameters:
file -
contents -
Throws:
java.io.IOException
Since:
0.5

saveFileToDisk

public static void saveFileToDisk(java.lang.String fileName,
                                  byte[] contents)
                           throws java.io.IOException
Convenience one-liner to save data to a specific file on Disk. Will abend if file already exists.

Parameters:
file - name
contents -
Throws:
java.io.IOException
Since:
0.5

saveFileToDisk

public static void saveFileToDisk(java.io.File file,
                                  byte[] contents)
                           throws java.io.IOException
Convenience one-liner to save data to a specific file on Disk. Will abend if file already exists.

Parameters:
file -
contents -
Throws:
java.io.IOException
Since:
0.5

createDirectory

public static void createDirectory(java.lang.String dirName)
                            throws java.io.IOException
Convenience one-liner to create a directory if the file doesn't exist. Will validate that the file is a directory if it does exist. Will throw an exception of the file exists and s not a directory.

Parameters:
Directory - Name
Throws:
java.io.IOException
Since:
0.5

purgeDirectory

public static void purgeDirectory(java.io.File dir)
Convenience one-liner to purge a directory including all files and subdirectories -- Use With Extreme Caution!

Since:
0.5

purgeDirectory

public static void purgeDirectory(java.lang.String dirName)
Convenience one-liner to purge a directory including all files and subdirectories -- Use With Extreme Caution!

Parameters:
Directory - Name
Since:
0.5

purgeUnderlyingFiles

public static void purgeUnderlyingFiles(java.lang.String dirName,
                                        java.util.GregorianCalendar updatedBeforeDate)
Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!

Parameters:
Directory - Name
Earliest - Date Permitted
Since:
0.5

purgeUnderlyingFiles

public static void purgeUnderlyingFiles(java.lang.String dirName,
                                        java.util.Date updatedBeforeDate)
Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!

Parameters:
Directory - Name
Earliest - Date Permitted
Since:
0.5

purgeUnderlyingFiles

public static void purgeUnderlyingFiles(java.lang.String dirName,
                                        long updatedBeforeTime)
Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!

Parameters:
Directory - Name
Earliest - Date Permitted
Since:
0.5

purgeUnderlyingFiles

public static void purgeUnderlyingFiles(java.io.File dir,
                                        long updatedBeforeTime)
Convenience one-liner to purge underlying files older than a specified age -- Use With Extreme Caution!

Parameters:
Directory -
Earliest - Date Permitted in millis
Since:
0.5


Copyright © 2003 Delta Vortex Technologies, Inc. All Rights Reserved.