org.jutil
Class TFile

java.lang.Object
  extended by org.jutil.TFile

public final class TFile
extends java.lang.Object

This is the TFile utility code class.


Constructor Summary
TFile()
          Ensure that no one can create instances of this Class.
 
Method Summary
static int copy(java.io.File src, java.io.File dest)
          org.jutil.TFile.copy(File src, File dest); return bytes written
static int copy(java.io.File src, java.io.File dest, boolean erase)
          org.jutil.TFile.copy(File src, File dest, boolean eraseSrc); return bytes written
static boolean createDIR(java.io.File path)
          creates directory if doesn't exist.
USAGE: org.jutil.TFile.createDIR(strPath);
static boolean createDIR(java.lang.String path)
          creates directory if doesn't exist.
USAGE: org.jutil.TFile.createDIR(strPath);
static boolean delete(java.io.File file)
          org.jutil.TFile.delete(File file);
static boolean delete(java.lang.String fname)
          org.jutil.TFile.delete(String fname);
static java.lang.String extractExtension(java.lang.String file)
           
static java.lang.String extractFileName(java.lang.String file)
           
static java.lang.String extractPath(java.lang.String file)
           
static java.lang.String getFullFileName(java.lang.String path, java.lang.String file)
          org.jutil.TFile.getFullFileName(strPath, strFileName);
static boolean hasChanged(java.io.File file, long oldTimeStamp)
          org.jutil.TFile.hasChanged(File file, long oldTimeStamp);
static boolean hasChanged(java.lang.String fileName, long oldTimeStamp)
          org.jutil.TFile.hasChanged(String fileName, long oldTimeStamp);
static void main(java.lang.String[] args)
           
static int move(java.io.File src, java.io.File dest)
          org.jutil.TFile.move(File src, File dest); return bytes written
static byte[] readToBytes(java.io.File file)
          org.jutil.TFile.readToBytes(File file);
static java.lang.String[] readToStringArray(java.io.File file)
          org.jutil.TFile.readToStringArray(File file);
static java.lang.StringBuffer readToStringBuffer(java.io.File file)
          org.jutil.TFile.readToStringBuffer(File file);
static java.lang.StringBuffer readToStringBuffer(java.io.File file, boolean raw)
          org.jutil.TFile.readToStringBuffer(File file, boolean raw); keeps line.separator dependant on machine that runs this method
static java.lang.StringBuffer readToStringBuffer(java.io.File file, boolean raw, java.lang.String lineSep)
           
static java.lang.String[] scanDirs(java.lang.String parent, java.io.FilenameFilter filter, boolean recursive)
          org.jutil.TFile.scanDirs(String parent, FilenameFilter filter, boolean recursive);
static java.lang.String[] scanDirs(java.lang.String parent, java.lang.String filter, boolean recursive)
           
static boolean touch(java.io.File file)
          Set the file's LastModified value, uses Current System time org.jutil.TFile.touch(File file);
static boolean touch(java.io.File file, long timeStamp)
          Set the file's LastModified value org.jutil.TFile.touch(File file, long timeStamp);
static void write(java.io.File file, byte[] bytes)
           
static void write(java.io.File file, char[] cbuf)
           
static void write(java.io.File file, java.lang.String[] array)
           
static void write(java.io.File file, java.lang.StringBuffer buffer)
           
static void write(java.io.File file, java.lang.StringBuffer buffer, boolean append)
           
static int writeBytes(java.io.InputStream istream, java.io.File dest)
           
static void zeroWrite(java.io.File file)
          org.jutil.TFile.zeroWrite(File _file); write new byte[0] to file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TFile

public TFile()
Ensure that no one can create instances of this Class.

Method Detail

main

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

scanDirs

public static final java.lang.String[] scanDirs(java.lang.String parent,
                                                java.lang.String filter,
                                                boolean recursive)

scanDirs

public static final java.lang.String[] scanDirs(java.lang.String parent,
                                                java.io.FilenameFilter filter,
                                                boolean recursive)
org.jutil.TFile.scanDirs(String parent, FilenameFilter filter, boolean recursive);


getFullFileName

public static final java.lang.String getFullFileName(java.lang.String path,
                                                     java.lang.String file)
org.jutil.TFile.getFullFileName(strPath, strFileName);


hasChanged

public static final boolean hasChanged(java.lang.String fileName,
                                       long oldTimeStamp)
                                throws java.io.FileNotFoundException
org.jutil.TFile.hasChanged(String fileName, long oldTimeStamp);

Throws:
java.io.FileNotFoundException

hasChanged

public static final boolean hasChanged(java.io.File file,
                                       long oldTimeStamp)
                                throws java.io.FileNotFoundException
org.jutil.TFile.hasChanged(File file, long oldTimeStamp);

Throws:
java.io.FileNotFoundException

touch

public static final boolean touch(java.io.File file)
                           throws java.io.FileNotFoundException
Set the file's LastModified value, uses Current System time org.jutil.TFile.touch(File file);

Parameters:
file - The new file to act on
Returns:
true if and only if the operation succeeded; false otherwise
Throws:
java.io.FileNotFoundException - If the file does not exist
java.lang.IllegalArgumentException - If the argument is negative
java.lang.SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.io.FileDescriptor) method denies write access to the named file
Since:
1.2

touch

public static final boolean touch(java.io.File file,
                                  long timeStamp)
                           throws java.io.FileNotFoundException
Set the file's LastModified value org.jutil.TFile.touch(File file, long timeStamp);

Parameters:
file - The new file to act on
time - The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
Returns:
true if and only if the operation succeeded; false otherwise
Throws:
java.io.FileNotFoundException - If the file does not exist
java.lang.IllegalArgumentException - If the argument is negative
java.lang.SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.io.FileDescriptor) method denies write access to the named file
Since:
1.2

delete

public static final boolean delete(java.lang.String fname)
                            throws java.io.IOException
org.jutil.TFile.delete(String fname);

Throws:
java.io.IOException

delete

public static final boolean delete(java.io.File file)
                            throws java.io.IOException
org.jutil.TFile.delete(File file);

Throws:
java.io.IOException

copy

public static final int copy(java.io.File src,
                             java.io.File dest)
                      throws java.io.IOException
org.jutil.TFile.copy(File src, File dest); return bytes written

Throws:
java.io.IOException

move

public static final int move(java.io.File src,
                             java.io.File dest)
                      throws java.io.IOException
org.jutil.TFile.move(File src, File dest); return bytes written

Throws:
java.io.IOException

copy

public static final int copy(java.io.File src,
                             java.io.File dest,
                             boolean erase)
                      throws java.io.IOException
org.jutil.TFile.copy(File src, File dest, boolean eraseSrc); return bytes written

Throws:
java.io.IOException

writeBytes

public static final int writeBytes(java.io.InputStream istream,
                                   java.io.File dest)
                            throws java.io.IOException
Throws:
java.io.IOException

zeroWrite

public static final void zeroWrite(java.io.File file)
org.jutil.TFile.zeroWrite(File _file); write new byte[0] to file


readToBytes

public static final byte[] readToBytes(java.io.File file)
                                throws java.io.FileNotFoundException,
                                       java.io.IOException
org.jutil.TFile.readToBytes(File file);

Throws:
java.io.FileNotFoundException
java.io.IOException

write

public static final void write(java.io.File file,
                               byte[] bytes)
                        throws java.io.IOException
Throws:
java.io.IOException

write

public static final void write(java.io.File file,
                               char[] cbuf)
                        throws java.io.IOException
Throws:
java.io.IOException

readToStringBuffer

public static final java.lang.StringBuffer readToStringBuffer(java.io.File file)
                                                       throws java.io.FileNotFoundException,
                                                              java.io.IOException
org.jutil.TFile.readToStringBuffer(File file);

Throws:
java.io.FileNotFoundException
java.io.IOException

readToStringBuffer

public static final java.lang.StringBuffer readToStringBuffer(java.io.File file,
                                                              boolean raw)
                                                       throws java.io.FileNotFoundException,
                                                              java.io.IOException
org.jutil.TFile.readToStringBuffer(File file, boolean raw); keeps line.separator dependant on machine that runs this method

Throws:
java.io.FileNotFoundException
java.io.IOException

readToStringBuffer

public static final java.lang.StringBuffer readToStringBuffer(java.io.File file,
                                                              boolean raw,
                                                              java.lang.String lineSep)
                                                       throws java.io.FileNotFoundException,
                                                              java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

readToStringArray

public static final java.lang.String[] readToStringArray(java.io.File file)
                                                  throws java.io.FileNotFoundException,
                                                         java.io.IOException
org.jutil.TFile.readToStringArray(File file);

Throws:
java.io.FileNotFoundException
java.io.IOException

write

public static final void write(java.io.File file,
                               java.lang.StringBuffer buffer)
                        throws java.io.IOException
Throws:
java.io.IOException

write

public static final void write(java.io.File file,
                               java.lang.StringBuffer buffer,
                               boolean append)
                        throws java.io.IOException
Throws:
java.io.IOException

write

public static final void write(java.io.File file,
                               java.lang.String[] array)
                        throws java.io.IOException
Throws:
java.io.IOException

createDIR

public static final boolean createDIR(java.lang.String path)
creates directory if doesn't exist.
USAGE: org.jutil.TFile.createDIR(strPath);


createDIR

public static final boolean createDIR(java.io.File path)
creates directory if doesn't exist.
USAGE: org.jutil.TFile.createDIR(strPath);


extractExtension

public static final java.lang.String extractExtension(java.lang.String file)

extractFileName

public static final java.lang.String extractFileName(java.lang.String file)

extractPath

public static final java.lang.String extractPath(java.lang.String file)