|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.denova.io.FileSystem
Manage files and directories.
| Constructor Summary | |
FileSystem()
|
|
| Method Summary | |
static void |
appendFile(java.io.File fromPath,
java.io.File toPath)
Appends a file. |
static void |
copyDirectory(java.io.File fromDir,
java.io.File toDir)
Copies all the files from one directory to another directory. |
static void |
copyDirectory(java.io.File fromDir,
java.lang.String toDirPath)
Copies all the files from one directory to another directory. |
static void |
copyDirectory(java.lang.String fromDirPath,
java.io.File toDir)
Copies all the files from one directory to another directory. |
static void |
copyDirectory(java.lang.String fromDirPath,
java.lang.String toDirPath)
Copies all the files from one directory to another directory. |
static void |
copyFile(java.io.File fromPath,
java.io.File toPath)
Copies a file. |
static void |
copyFile(java.io.File fromPath,
java.lang.String toPathname)
Copies an individual file. |
static void |
copyFile(java.lang.String fromPathname,
java.io.File toPath)
Copies a file. |
static void |
copyFile(java.lang.String fromPathname,
java.lang.String toPathname)
Copies a single file by filename. |
static void |
copyFileToStream(java.io.File fromFile,
java.io.OutputStream oStream)
Copies a file to an output stream. |
static void |
copyFileToStream(java.lang.String pathname,
java.io.OutputStream oStream)
Copies a file to an output stream. |
static void |
copyFileToZipStream(java.io.File fromFile,
java.lang.String toFilename,
java.io.File baseDir,
java.util.zip.ZipOutputStream zOut)
Copies a file to an zip output stream. |
static void |
copyFileToZipStream(java.io.File fromFile,
java.lang.String filename,
java.util.zip.ZipOutputStream zOut)
Copies a file to an zip output stream. |
static void |
copyFileToZipStream(java.lang.String filename,
java.util.zip.ZipOutputStream zOut)
Copies a file to an zip output stream. |
static void |
copyStreams(java.io.InputStream in,
java.io.OutputStream out)
Copies an input stream to an output stream. |
static void |
copyStreams(java.io.InputStream in,
java.io.OutputStream out,
long size)
Copies an input stream to an output stream. |
static void |
copyStreamToFile(java.io.InputStream iStream,
java.io.File toFile)
Copies a file to an output stream. |
static void |
copyStreamToFile(java.io.InputStream iStream,
java.lang.String pathname)
Copies a file to an output stream. |
static void |
createEmptyFile(java.io.File toFile)
Create an empty file. |
static java.lang.String |
findFileInPath(java.lang.String filename)
Find a file in the path. |
static long |
getCrc(java.io.File f)
Returns the CRC for the file. |
static boolean |
getFile(java.lang.String filename)
|
static boolean |
getFile(java.lang.String filename,
java.io.InputStream in)
|
static java.io.InputStream |
getFileStream(java.lang.String filename)
Get an input stream for a file. |
static javax.swing.JProgressBar |
getProgressBar()
Returns the currently active progress bar. |
static javax.swing.JLabel |
getProgressStatus()
Returns the current progress bar's status. |
static java.lang.String |
getRelativePathname(java.io.File baseDir,
java.io.File f)
Gets a pathname relative to a base directory. |
static java.net.URL |
getResource(java.lang.String name)
IMPORTANT: Generally, you don't want to use this method because it isn't very portable; we're keeping it because sometimes we use it as a last ditch effort to get a resource |
static boolean |
getResourceAsFile(java.lang.String filename)
Copy a resource to a file. |
static boolean |
getResourceAsFile(java.lang.String filename,
java.lang.String pathname)
Copy a resource to a file. |
static java.io.InputStream |
getResourceAsStream(java.lang.String name)
Get an input stream for a resource. |
static boolean |
isRootDirectory(java.io.File d)
Returns true if the parameter points to the root directory. |
static boolean |
isRootDirectory(java.lang.String d)
Returns true if the parameter points to the root directory. |
static int |
read(java.io.InputStream in)
Reads a byte from an input stream. |
static int |
read(java.io.InputStream in,
byte[] bytes)
Reads bytes from an input stream. |
static int |
read(java.io.InputStream in,
byte[] bytes,
int bytesToRead)
Reads from the zero byte through the bytesToRead element from an input stream. |
static boolean |
removeDirectory(java.io.File directory)
Deletes all the files from the directory and then deletes the directory. |
static boolean |
removeDirectory(java.lang.String dirName)
Deletes all the files from the directory and then deletes the directory. |
static boolean |
removeDirectoryContents(java.io.File directory)
Deletes the contents of the directory, but not the directory. |
static boolean |
removeDirectoryContents(java.lang.String dirName)
Deletes the contents of the directory, but not the directory. |
static boolean |
removeFile(java.lang.String name)
Deletes the file from the system. |
static boolean |
removeSubdirectories(java.io.File directory)
|
static void |
setHostUrl(java.lang.String newHostUrl)
Set the host url where a resource might be found. |
static void |
setProgressBar(javax.swing.JProgressBar bar)
Set the progress bar to use when copying files or calculating the CRC. |
static void |
setProgressStatus(javax.swing.JLabel status)
Set the status for the progress bar. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileSystem()
| Method Detail |
public static java.lang.String findFileInPath(java.lang.String filename)
filename - is the name of the file to locate. A pathname should not be included.
public static boolean removeFile(java.lang.String name)
name - is the full pathname for the file.
public static boolean removeDirectory(java.lang.String dirName)
dirName - is the full pathname for the directory.
public static boolean removeDirectory(java.io.File directory)
directory - is the name of the directory to delete.
public static boolean removeDirectoryContents(java.lang.String dirName)
dirName - is the full pathname to the directory
public static boolean removeDirectoryContents(java.io.File directory)
directory - is a File that points to the directory
public static void copyFile(java.lang.String fromPathname,
java.lang.String toPathname)
throws java.lang.Exception
fromPathname - is the full pathname to the original filejava.lang.Exception
public static void copyFile(java.io.File fromPath,
java.lang.String toPathname)
throws java.lang.Exception
If the toPathname already exists, then it is overwritten.
fromPath - is a File for the original filejava.lang.Exception
public static void copyFile(java.lang.String fromPathname,
java.io.File toPath)
throws java.lang.Exception
If the toPath already exists, then it is overwritten.
fromPathname - is the full pathname to the original filejava.lang.Exception
public static void copyFile(java.io.File fromPath,
java.io.File toPath)
throws java.lang.Exception
If the toPath already exists, then it is overwritten.
fromPath - is a File for the original filejava.lang.Exception
public static void copyFileToStream(java.lang.String pathname,
java.io.OutputStream oStream)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
pathname - source file that is being copiedjava.lang.Exception
public static void copyFileToStream(java.io.File fromFile,
java.io.OutputStream oStream)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
fromFile - source file that is being copiedjava.lang.Exception
public static void copyStreamToFile(java.io.InputStream iStream,
java.lang.String pathname)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
pathname - source file that is being copiedjava.lang.Exception
public static void copyStreamToFile(java.io.InputStream iStream,
java.io.File toFile)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
iStream - source file that is being copiedjava.lang.Exception
public static void copyFileToZipStream(java.lang.String filename,
java.util.zip.ZipOutputStream zOut)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
filename - source file that is being copiedjava.lang.Exception
public static void copyFileToZipStream(java.io.File fromFile,
java.lang.String filename,
java.util.zip.ZipOutputStream zOut)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
fromFile - source file that is being copiedjava.lang.Exception
public static void copyFileToZipStream(java.io.File fromFile,
java.lang.String toFilename,
java.io.File baseDir,
java.util.zip.ZipOutputStream zOut)
throws java.lang.Exception
If the destination file already exists, it is overwritten.
fromFile - source file that is being copiedjava.lang.Exception
public static void appendFile(java.io.File fromPath,
java.io.File toPath)
throws java.lang.Exception
If the toPath doesn't exist, then it creates.
fromPath - is a pathname for the original filejava.lang.Exception
public static void createEmptyFile(java.io.File toFile)
throws java.lang.Exception
If the toFile already exists, then it is overwritten.
toFile - is full path for the file that will be created
java.lang.Exception
public static java.lang.String getRelativePathname(java.io.File baseDir,
java.io.File f)
throws java.lang.Exception
baseDir - the base directoryjava.lang.Exception
public static void copyDirectory(java.lang.String fromDirPath,
java.lang.String toDirPath)
throws java.lang.Exception
If the destination directory already exists, then the source files are added to the destination directory. Source files overwrite any existing files with the same name in the destination.
fromDirPath - source directory that is being copiedjava.lang.Exception
public static void copyDirectory(java.io.File fromDir,
java.lang.String toDirPath)
throws java.lang.Exception
If the destination directory already exists, then the source files are added to the destination directory. Source files overwrite any existing files with the same name in the destination.
fromDir - source directory that is being copiedjava.lang.Exception
public static void copyDirectory(java.lang.String fromDirPath,
java.io.File toDir)
throws java.lang.Exception
If the destination directory already exists, then the source files are added to the destination directory. Source files overwrite any existing files with the same name in the destination.
fromDirPath - source directory that is being copiedjava.lang.Exception
public static void copyDirectory(java.io.File fromDir,
java.io.File toDir)
throws java.lang.Exception
If the destination directory already exists, then the source files are added to the destination directory. Source files overwrite any existing files with the same name in the destination.
fromDir - source directory that is being copiedjava.lang.Exception
public static void copyStreams(java.io.InputStream in,
java.io.OutputStream out)
throws java.lang.Exception
If the destination stream already exists, it is overwritten.
in - source stream that is being copiedjava.lang.Exception
public static void copyStreams(java.io.InputStream in,
java.io.OutputStream out,
long size)
throws java.lang.Exception
If the destination stream already exists, it is overwritten. The file size is used to calculate the percentage copied.
in - source stream that is being copiedjava.lang.Exception
public static boolean getResourceAsFile(java.lang.String filename)
throws java.lang.Exception
filename - to get, including the destination pathname.
java.lang.Exception
public static boolean getResourceAsFile(java.lang.String filename,
java.lang.String pathname)
throws java.lang.Exception
filename - file to get.pathname - destination pathname.
java.lang.Exceptionpublic static java.io.InputStream getResourceAsStream(java.lang.String name)
name - filename to get.
public static java.net.URL getResource(java.lang.String name)
public static boolean getFile(java.lang.String filename)
throws java.lang.Exception
java.lang.Exception
public static boolean getFile(java.lang.String filename,
java.io.InputStream in)
throws java.lang.Exception
java.lang.Exception
public static java.io.InputStream getFileStream(java.lang.String filename)
throws java.lang.Exception
filename - to get.
java.lang.Exception
public static int read(java.io.InputStream in)
throws java.io.IOException
in - input stream where byte is read from
java.io.IOException
public static int read(java.io.InputStream in,
byte[] bytes)
throws java.io.IOException
in - an input stream that is already openjava.io.IOException
public static int read(java.io.InputStream in,
byte[] bytes,
int bytesToRead)
throws java.io.IOException
in - input stream that is already openjava.io.IOExceptionpublic static boolean isRootDirectory(java.lang.String d)
On Windows, it returns true if the parameter points to the root for the File's drive.
public static boolean isRootDirectory(java.io.File d)
On Windows, it returns true if the parameter points to the root for the File's drive.
public static long getCrc(java.io.File f)
throws java.lang.Exception
java.lang.Exceptionpublic static void setHostUrl(java.lang.String newHostUrl)
public static void setProgressBar(javax.swing.JProgressBar bar)
public static javax.swing.JProgressBar getProgressBar()
public static void setProgressStatus(javax.swing.JLabel status)
public static javax.swing.JLabel getProgressStatus()
public static boolean removeSubdirectories(java.io.File directory)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||