Java Doc for FileUtils.java in  » J2EE » jfox » org » jfox » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » jfox » org.jfox.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jfox.util.FileUtils

FileUtils
public class FileUtils (Code)

author:
   Young Yang




Method Summary
public static  booleancleanDirectory(File directory)
     Clean a directory without deleting it.
public static  Stringcontent(File file)
    
public static  Filecopy(File source, File dir)
     Copy a file.
public static  booleandelete(File file)
    

Delete a file.

public static  booleandeleteDirectory(File dir)
     Delete a file, or a directory and all of its contents.
Parameters:
  dir - The directory or file to delete.
public static  voiddeleteOnExit(File file)
     Schedule a file to be deleted when JVM exits.
public static  voidextractJar(File jarFile, File dest)
     Dump the contents of a JarArchive to the dpecified destination.
public static  Map<String, byte[]>getClassBytesMap(URL location)
    
public static  Map<String, byte[]>getClassBytesMap(File file)
    
public static  URLgetDescriptor(URLClassLoader loader, String descriptorName)
    
public static  ManifestgetManifest(File jarFile)
    
public static  List<File>listFiles(File dir, FileFilter filter)
    
public static  voidmain(String[] args)
    
public static  Filemove(File source, File dir)
    
public static  FiletoFile(URL url)
     Convert from a URL to a File.
Parameters:
  url - File URL.
public static  URL[]toURLs(File[] files)
     Convert the array of Files into a list of URLs.
public static  voidtouch(File file)
     Implements the same behaviour as the "touch" utility on Unix.



Method Detail
cleanDirectory
public static boolean cleanDirectory(File directory)(Code)
Clean a directory without deleting it.
Parameters:
  directory - directory to clean



content
public static String content(File file) throws IOException(Code)
get file content



copy
public static File copy(File source, File dir) throws IOException(Code)
Copy a file.
Parameters:
  source - Source file to copy.
Parameters:
  dir - Destination target dir.
throws:
  java.io.IOException - Failed to copy file.



delete
public static boolean delete(File file)(Code)

Delete a file. If file is a directory, delete it and all sub-directories.

The difference between File.delete() and this method are:

  • A directory to be deleted does not have to be empty.
  • You get exceptions when a file or directory cannot be deleted. (java.io.File methods returns a boolean)

Parameters:
  file - file or directory to delete.



deleteDirectory
public static boolean deleteDirectory(File dir)(Code)
Delete a file, or a directory and all of its contents.
Parameters:
  dir - The directory or file to delete. True if all delete operations were successfull.



deleteOnExit
public static void deleteOnExit(File file) throws IOException(Code)
Schedule a file to be deleted when JVM exits. If file is directory delete it and all sub-directories.
Parameters:
  file - file or directory to delete.
throws:
  IOException - in case deletion is unsuccessful



extractJar
public static void extractJar(File jarFile, File dest) throws IOException(Code)
Dump the contents of a JarArchive to the dpecified destination.



getClassBytesMap
public static Map<String, byte[]> getClassBytesMap(URL location) throws IOException(Code)
获得一个 URL 中所有的Class Name
Parameters:
  location - url location
throws:
  IOException - ioexception



getClassBytesMap
public static Map<String, byte[]> getClassBytesMap(File file) throws IOException(Code)
从文件或目录中�索所有的 class 文件
Parameters:
  file - file classname=>class bytes
throws:
  IOException - ioexception



getDescriptor
public static URL getDescriptor(URLClassLoader loader, String descriptorName)(Code)
use URLClassLoader.findResource, this method will not find resource use parent
Parameters:
  loader -
Parameters:
  descriptorName - null if no such descriptor



getManifest
public static Manifest getManifest(File jarFile) throws IOException(Code)



listFiles
public static List<File> listFiles(File dir, FileFilter filter)(Code)
list Files recursively
Parameters:
  dir - directory
Parameters:
  filter - file filter File list



main
public static void main(String[] args) throws Exception(Code)



move
public static File move(File source, File dir) throws IOException(Code)
move the source file to the targe directory
Parameters:
  source -
Parameters:
  dir -



toFile
public static File toFile(URL url)(Code)
Convert from a URL to a File.
Parameters:
  url - File URL. The equivalent File object, or nullif the URL's protocol is not file



toURLs
public static URL[] toURLs(File[] files) throws IOException(Code)
Convert the array of Files into a list of URLs.
Parameters:
  files - the array of files the array of URLs
throws:
  IOException - if an error occurs



touch
public static void touch(File file) throws IOException(Code)
Implements the same behaviour as the "touch" utility on Unix. It creates a new file with size 0 or, if the file exists already, it is opened and closed without modifying it, but updating the file date and time.
Parameters:
  file - the File to touch
throws:
  IOException - If an I/O problem occurs



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.