com.isogen.util
Class FileUtil

java.lang.Object
  extended bycom.isogen.util.FileUtil

public class FileUtil
extends java.lang.Object

Author:
adrian * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments

Constructor Summary
FileUtil()
           
 
Method Summary
static java.lang.String byteToHex(byte b)
           
static java.lang.String charToHex(char c)
           
static void copyDirectory(java.io.File sourceDir, java.io.File destDir)
           
static void copyDirectory(java.io.File sourceDir, java.io.File destDir, boolean ignore)
           
static void copyFile(java.io.File source, java.io.File dest)
          Copies a file from one location to another.
static void copyFile(java.io.File source, java.io.File dest, boolean quiet)
          Copy one file to another file.
static void copyFile(java.io.InputStream source, java.io.File dest)
          Copy an input stream to a file.
static void copyFile(java.io.InputStream source, java.io.File dest, boolean quiet)
          Copy an input stream to a file.
static void copyUpdatedFile(java.io.File sourceFile, java.io.File destDir)
           
static void deleteDirectory(java.io.File dir)
           
static java.lang.String getAbsolutePath(java.lang.String basePath, java.lang.String relativePath)
          Given a base path (e.g., input source file path) and a path relative to it, * returns an operating-system-specific absolute path formed by combining the base part * with the relative part.
static java.lang.String getFileBaseName(java.lang.String filePath)
          Given a filePath, returns the filename minus the extension, e.g., if * the input filename "/a/b/c/foo.bar" returns "foo".
static java.lang.String getFileDir(java.lang.String filePath)
          Given a filePath, returns the directory part.
static java.lang.String getFileExtension(java.lang.String filePath)
          Given a filePath, returns the extension part.
static java.lang.String getFileName(java.lang.String filePath)
          Given a filePath, returns the filename part.
static java.lang.String getRelativePath(java.lang.String filePath, java.lang.String targetPath)
          Returns the relative from targetPath to filePath.
static void printFileBytes(java.lang.String fn)
           
static void printFileBytes(java.lang.String fn, int startByte, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

copyDirectory

public static void copyDirectory(java.io.File sourceDir,
                                 java.io.File destDir)
                          throws java.io.IOException
Throws:
java.io.IOException

copyDirectory

public static void copyDirectory(java.io.File sourceDir,
                                 java.io.File destDir,
                                 boolean ignore)
                          throws java.io.IOException
Throws:
java.io.IOException

copyUpdatedFile

public static void copyUpdatedFile(java.io.File sourceFile,
                                   java.io.File destDir)
                            throws java.io.IOException
Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.File source,
                            java.io.File dest)
                     throws java.io.IOException
Copies a file from one location to another. * @param source The source file. * @param dest The destination file. * @throws IOException Thrown if there is any error reading or writing the files.

Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.File source,
                            java.io.File dest,
                            boolean quiet)
                     throws java.io.IOException
Copy one file to another file. * * @param source The file to be copied. * @param dest The file to copy to * @param quiet If true, do not print the copying message. * @throws IOException

Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.InputStream source,
                            java.io.File dest)
                     throws java.io.IOException
Copy an input stream to a file. * * @param source The InputStream to be copied. * @param dest The file to copy to * @throws IOException

Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.InputStream source,
                            java.io.File dest,
                            boolean quiet)
                     throws java.io.IOException
Copy an input stream to a file. * * @param source The InputStream to be copied. * @param dest The file to copy to * @param quiet If true, do not print the copying message. * @throws IOException

Throws:
java.io.IOException

deleteDirectory

public static void deleteDirectory(java.io.File dir)

getFileDir

public static java.lang.String getFileDir(java.lang.String filePath)
Given a filePath, returns the directory part. * @param filePath The path to get the directory part of. * @return The directory.


getFileName

public static java.lang.String getFileName(java.lang.String filePath)
Given a filePath, returns the filename part. * @param filePath The path to get the filename part of. * @return The filename


getFileExtension

public static java.lang.String getFileExtension(java.lang.String filePath)
Given a filePath, returns the extension part. * @param filePath The path to get the extension part of. * @return The extension, without the leading "."


getFileBaseName

public static java.lang.String getFileBaseName(java.lang.String filePath)
Given a filePath, returns the filename minus the extension, e.g., if * the input filename "/a/b/c/foo.bar" returns "foo". * @param filePath The path to get the base part of. * @return The filename, without the extension.


getRelativePath

public static java.lang.String getRelativePath(java.lang.String filePath,
                                               java.lang.String targetPath)
Returns the relative from targetPath to filePath. * @param filePath The path the result is relative to. Must be an absolute path and must * include the filename part. * @param targetPath The path the result is derived from. Must be an absolute path, * otherwise it is returned immediately. * @return The relative path, if any.


printFileBytes

public static void printFileBytes(java.lang.String fn,
                                  int startByte,
                                  int length)
                           throws java.io.IOException
Throws:
java.io.IOException

printFileBytes

public static void printFileBytes(java.lang.String fn)
                           throws java.io.IOException
Throws:
java.io.IOException

byteToHex

public static java.lang.String byteToHex(byte b)

charToHex

public static java.lang.String charToHex(char c)

getAbsolutePath

public static java.lang.String getAbsolutePath(java.lang.String basePath,
                                               java.lang.String relativePath)
Given a base path (e.g., input source file path) and a path relative to it, * returns an operating-system-specific absolute path formed by combining the base part * with the relative part. * @param basePath * @param relativePath * @return Absolute path string. Returns "" if there is a problem constructing the path.