|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jfox.util.FileUtils
public class FileUtils
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
cleanDirectory(java.io.File directory)
Clean a directory without deleting it. |
static java.lang.String |
content(java.io.File file)
get file content |
static java.io.File |
copy(java.io.File source,
java.io.File dir)
Copy a file. |
static boolean |
delete(java.io.File file)
Delete a file. |
static boolean |
deleteDirectory(java.io.File dir)
Delete a file, or a directory and all of its contents. |
static void |
deleteOnExit(java.io.File file)
Schedule a file to be deleted when JVM exits. |
static void |
extractJar(java.io.File jarFile,
java.io.File dest)
Dump the contents of a JarArchive to the dpecified destination. |
static java.util.Map<java.lang.String,byte[]> |
getClassBytesMap(java.io.File file)
从文件或目录中搜索所有的 class 文件 |
static java.util.Map<java.lang.String,byte[]> |
getClassBytesMap(java.net.URL location)
获得一个 URL 中所有的Class Name |
static java.net.URL |
getDescriptor(java.net.URLClassLoader loader,
java.lang.String descriptorName)
use URLClassLoader.findResource, this method will not find resource use parent |
static java.util.jar.Manifest |
getManifest(java.io.File jarFile)
|
static java.util.List<java.io.File> |
listFiles(java.io.File dir,
java.io.FileFilter filter)
list Files recursively |
static void |
main(java.lang.String[] args)
|
static java.io.File |
move(java.io.File source,
java.io.File dir)
move the source file to the targe directory |
static java.io.File |
toFile(java.net.URL url)
Convert from a URL to a File. |
static void |
touch(java.io.File file)
Implements the same behaviour as the "touch" utility on Unix. |
static java.net.URL[] |
toURLs(java.io.File[] files)
Convert the array of Files into a list of URLs. |
| 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 boolean delete(java.io.File file)
file - file or directory to delete.public static boolean deleteDirectory(java.io.File dir)
dir - The directory or file to delete.
public static boolean cleanDirectory(java.io.File directory)
directory - directory to clean
public static void deleteOnExit(java.io.File file)
throws java.io.IOException
file - file or directory to delete.
java.io.IOException - in case deletion is unsuccessful
public static java.io.File copy(java.io.File source,
java.io.File dir)
throws java.io.IOException
source - Source file to copy.dir - Destination target dir.
java.io.IOException - Failed to copy file.
public static java.io.File move(java.io.File source,
java.io.File dir)
throws java.io.IOException
source - dir -
java.io.IOException
public static void touch(java.io.File file)
throws java.io.IOException
file - the File to touch
java.io.IOException - If an I/O problem occurs
public static java.net.URL[] toURLs(java.io.File[] files)
throws java.io.IOException
files - the array of files
java.io.IOException - if an error occurspublic static java.io.File toFile(java.net.URL url)
URL to a File.
url - File URL.
File object, or null
if the URL's protocol is not file
public static java.lang.String content(java.io.File file)
throws java.io.IOException
java.io.IOException
public static java.util.List<java.io.File> listFiles(java.io.File dir,
java.io.FileFilter filter)
dir - directoryfilter - file filter
public static void extractJar(java.io.File jarFile,
java.io.File dest)
throws java.io.IOException
java.io.IOException
public static java.net.URL getDescriptor(java.net.URLClassLoader loader,
java.lang.String descriptorName)
loader - descriptorName -
public static java.util.jar.Manifest getManifest(java.io.File jarFile)
throws java.io.IOException
java.io.IOException
public static java.util.Map<java.lang.String,byte[]> getClassBytesMap(java.net.URL location)
throws java.io.IOException
location - url location
java.io.IOException - ioexception
public static java.util.Map<java.lang.String,byte[]> getClassBytesMap(java.io.File file)
throws java.io.IOException
file - file
java.io.IOException - ioexception
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||