|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.adobe.idml.FileUtils
public abstract class FileUtils
File specific utility methods used by other classes in the package.
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
static void |
CopyDir(java.io.File src,
java.io.File dest)
Copies the contents of a source directory into a destination directory. |
static void |
CopyFile(java.io.File src,
java.io.File dest)
Copy a file |
static java.io.File |
createFile(java.lang.String filePath)
Creates a text file at the location specified. |
static java.io.File |
CreateTempDir()
Creates a temporary directory. |
static java.io.File |
CreateTempFile()
Creates a temp file that is deleted on exit. |
static boolean |
DeleteDirectory(java.io.File dir)
Deletes the directory specified by dir. |
static boolean |
deleteFile(java.lang.String filePath)
Deletes a file. |
static void |
ensureDirectory(java.io.File dir)
Creates the directory if it does not already exist. |
static void |
ensureDirectory(java.lang.String dirPath)
Creates the directory if it does not already exist. |
static void |
ensureParentDirectory(java.lang.String filePath)
Ensures that the directory containing the file specified exists. |
static java.io.File |
getDirectory(java.lang.String dirPath)
Returns a file object representing the path given. |
static java.io.File |
getFile(java.lang.String filePath)
Returns a file object representing the path given. |
static java.lang.String |
getFileSize(java.io.File file)
Get the size of a file in Kilobytes. |
static java.lang.String |
getFileType(java.lang.String filePath)
Get the file extension for a file. |
static java.io.BufferedWriter |
getFileWriter(java.io.File txtFile)
Gets a buffered writer for a text file. |
static java.io.File |
getIdmlReferencedFile(java.lang.String filePath)
Returns a file object representing the path given. |
static java.io.File |
getParentDirectory(java.io.File file)
Returns the parent directory for the file provided. |
static java.io.File |
getParentDirectory(java.lang.String filePath)
Returns the parent directory for the file provided. |
static java.lang.String |
getParentDirectoryPath(java.lang.String filePath)
Given a file path this method returns the parent directory path. |
static java.lang.String |
getRelativePath(java.io.File fromDir,
java.io.File toFile)
Returns a relative path from the directory provided to the file specified. |
static java.lang.String |
getRelativePath(java.lang.String fromDirPath,
java.lang.String toFilePath)
Returns a relative path from the directory provided to the file specified. |
static void |
verifyDirectory(java.io.File dir)
Throws an error if the file object representing the directory is invalid. |
static void |
verifyDirectory(java.lang.String dirPath)
Throws an error if the file object is invalid. |
static void |
verifyFile(java.io.File file)
Throws an error if the file object is invalid. |
static void |
verifyFile(java.lang.String filePath)
Throws an error if the file object is invalid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileUtils()
| Method Detail |
|---|
public static java.lang.String getFileType(java.lang.String filePath)
filePath - The path to the file.
public static java.lang.String getFileSize(java.io.File file)
file - The file object to obtain the size of.
public static java.io.File getFile(java.lang.String filePath)
throws java.io.IOException
filePath - The path to the file.
java.io.IOException
public static java.io.File getIdmlReferencedFile(java.lang.String filePath)
throws PackageException
filePath - The path to the file.
PackageException
public static java.io.File createFile(java.lang.String filePath)
throws java.io.IOException
filePath - The location of the file to be created.
java.io.IOException
public static java.io.BufferedWriter getFileWriter(java.io.File txtFile)
throws java.io.IOException
txtFile - The file to obtain a buffered writer for.
java.io.IOException
public static java.io.File getDirectory(java.lang.String dirPath)
throws java.io.IOException
dirPath - The path to the directory.
java.io.IOException
public static void verifyFile(java.lang.String filePath)
throws java.io.IOException
filePath - The path to the file to be tested.
java.io.IOException
public static void verifyFile(java.io.File file)
throws java.io.IOException
file - The file to be tested.
java.io.IOException
public static void verifyDirectory(java.lang.String dirPath)
throws java.io.IOException
dirPath - The path to the directory to be tested.
java.io.IOException
public static void verifyDirectory(java.io.File dir)
throws java.io.IOException
dir - The directory object to be tested.
java.io.IOException
public static void ensureParentDirectory(java.lang.String filePath)
throws java.io.IOException
filePath - The path the to a file.
java.io.IOExceptionpublic static boolean DeleteDirectory(java.io.File dir)
dir - The directory to delete.
public static boolean deleteFile(java.lang.String filePath)
filePath - The location of the file to be deleted.
public static java.io.File CreateTempFile()
public static java.io.File CreateTempDir()
public static void CopyFile(java.io.File src,
java.io.File dest)
throws java.lang.Exception
src - The source file.dest - The destination file.
java.lang.Exception
public static void CopyDir(java.io.File src,
java.io.File dest)
throws java.lang.Exception
src - The directory to copy.dest - The destination directory to copy the files into.
java.lang.Exception
public static java.lang.String getRelativePath(java.lang.String fromDirPath,
java.lang.String toFilePath)
throws java.io.IOException
fromDirPath - The starting point of the relative path. Note: it needs to be a directory not a file.toFilePath - The target file of the relative path.
java.io.IOException
public static java.lang.String getRelativePath(java.io.File fromDir,
java.io.File toFile)
throws java.io.IOException
fromDir - The starting point of the relative path. Note: it needs to be a directory not a file.toFile - The target file of the relative path.
java.io.IOException
public static java.io.File getParentDirectory(java.io.File file)
throws java.io.IOException
file - A file object for the file.
java.io.IOException
public static java.io.File getParentDirectory(java.lang.String filePath)
throws java.io.IOException
filePath - The path to a file.
java.io.IOExceptionpublic static java.lang.String getParentDirectoryPath(java.lang.String filePath)
filePath - The absolute or relative path to a file
public static void ensureDirectory(java.lang.String dirPath)
throws java.io.IOException
dirPath - The location of the directory to ensure.
java.io.IOException
public static void ensureDirectory(java.io.File dir)
throws java.io.IOException
dir - The file object representing the directory to ensure.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||