Java Doc for FileUtil.java in  » Web-Framework » JAT » com » jat » util » file » 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 » Web Framework » JAT » com.jat.util.file 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jat.util.file.FileUtil

FileUtil
public class FileUtil (Code)

Title: JAT

Description:

Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)

Distributed under the terms of the GNU Lesser General Public License, v2.1 or later


author:
   stf
version:
   1.1




Method Summary
public static  voidcopy(String sourceFile, String targetFile, boolean force)
     Copy the file sourceFile to the file targetFile.
public static  voidcopy(File sourceFile, File targetFile, boolean force)
     Copy the file sourceFile to the file targetFile.
protected static  voidcopyDir(File sourceFile, File targetFile, boolean force)
     Copy the entire directory sourceFile to the directory targetFile.
public static  voiddeleteDirectory(File dir)
    
public static  VectorgetDirectories(String dir)
    
public static  VectorgetDirectoryNames(String dir)
    
public static  VectorgetFileNames(String dir)
    
public static  VectorgetFileNames(String dir, boolean includeDirectory)
    
public static  VectorgetFiles(String dir)
    
public static  VectorgetFiles(String dir, boolean includeDirectory)
    
public static  VectorgetFiles(String dir, boolean files, boolean includeDir, boolean name)
     Return the list of files and/or subdirectories of directory dir.
public static  Stringread(BufferedReader reader)
    
public static  StringreadFile(String file)
    
public static  StringreadFile(File file)
    
public static  voidsaveFile(String file, StringWriter sw)
    
public static  voidsaveFile(String file, String string)
    
public static  voidsaveFile(String file, byte[] bytes)
    
public static  voidsaveFile(File file, byte[] bytes)
    



Method Detail
copy
public static void copy(String sourceFile, String targetFile, boolean force) throws FileNotFoundException, IOException(Code)
Copy the file sourceFile to the file targetFile. If sourceFile is a directoty, copy the entire contents of sourceFile into targetFile directory
Parameters:
  sourceFile - the source file or directory
Parameters:
  targetFile - the source file or directory
Parameters:
  force - used to force overwriting of existent file (or files into directory and subdirectories)
throws:
  FileNotFoundException - if sourceFile does not exist
throws:
  IOException - if source file exists and force is false or if any I/O error occours



copy
public static void copy(File sourceFile, File targetFile, boolean force) throws FileNotFoundException, IOException(Code)
Copy the file sourceFile to the file targetFile. If sourceFile is a directoty, copy the entire contents of sourceFile into targetFile directory
Parameters:
  sourceFile - the source file or directory
Parameters:
  targetFile - the source file or directory
Parameters:
  force - used to force overwriting of existent file (or files into directory and subdirectories)
throws:
  FileNotFoundException - if sourceFile does not exist
throws:
  IOException - if source file exists and force is false or if any I/O error occours



copyDir
protected static void copyDir(File sourceFile, File targetFile, boolean force) throws FileNotFoundException, IOException(Code)
Copy the entire directory sourceFile to the directory targetFile.
Parameters:
  sourceFile - the source directory
Parameters:
  targetFile - the source directory
Parameters:
  force - used to force overwriting of existent files of directory and subdirectories
throws:
  FileNotFoundException - if sourceFile directory does not exist
throws:
  IOException - if at least a file of targetFile directory exists and force is false or if any I/O error occours



deleteDirectory
public static void deleteDirectory(File dir) throws IOException(Code)
Delete the entire directory dir (if exists)
Parameters:
  dir - the directory
throws:
  IOException - if dir is not a directory or if any I/O error occours



getDirectories
public static Vector getDirectories(String dir) throws IOException(Code)
Return the directories list of the directory dir
Parameters:
  dir - the directory file a Vector of directory (as File)
throws:
  IOException - if any I/O exception eccours



getDirectoryNames
public static Vector getDirectoryNames(String dir) throws IOException(Code)
Return the directories names list of the directory dir
Parameters:
  dir - the directory name a Vector of directory names (as String) without path
throws:
  IOException - if any I/O exception eccours



getFileNames
public static Vector getFileNames(String dir) throws IOException(Code)
Return the filenames list of the directory dir
Parameters:
  dir - the directory name a Vector of file names (as String) without path
throws:
  IOException - if any I/O exception eccours



getFileNames
public static Vector getFileNames(String dir, boolean includeDirectory) throws IOException(Code)
Return the filename list of the directory dir
Parameters:
  dir - the directory name
Parameters:
  includeDirectory - if true include subdirectories names un the return list a Vector of file names and directories (as String) without path
throws:
  IOException - if any I/O exception eccours



getFiles
public static Vector getFiles(String dir) throws IOException(Code)
Return the files list of the directory dir
Parameters:
  dir - the directory name a Vector of files (as File) excluded subdirectories
throws:
  IOException - if any I/O exception eccours



getFiles
public static Vector getFiles(String dir, boolean includeDirectory) throws IOException(Code)
Return the file list of the directory dir
Parameters:
  dir - the directory name
Parameters:
  includeDirectory - if true include subdirectories names un the return list a Vector of files (as File)
throws:
  IOException - if any I/O exception eccours



getFiles
public static Vector getFiles(String dir, boolean files, boolean includeDir, boolean name) throws IOException(Code)
Return the list of files and/or subdirectories of directory dir. It can return a Vector of names (java.lang.String) or a Vector of files (java.io.File) depending of names parameter; it can include in the returned Vector:
  • files of directory dir (if files parameter is true)
  • subdirectories of directory dir (if includeDir parameter is true)
  • both files and subdirectories of directory dir (if files and includeDir parameters are both true)
  • nothing (if files and includeDir parameters are both false)

Parameters:
  dir - the directory name
Parameters:
  files - if true the returned vector will contains also files directory dir
Parameters:
  includeDir - if true the returned vector will contains also sub directories of directory dir
Parameters:
  name - if true the returned vector will contains instances of java.io.File class,otherwise it will contains instances of filname without path (as java.lang.String) a Vector of java.io.File or java.lang.String depending of name parameter
throws:
  IOException -



read
public static String read(BufferedReader reader) throws java.io.IOException(Code)
Read from the reader and return the content as String
Parameters:
  reader - the reader the content of the reader as String
throws:
  java.io.IOException - if any I/O error occours



readFile
public static String readFile(String file) throws java.io.FileNotFoundException, java.io.IOException(Code)
Read file filename and return the content as String
Parameters:
  file - the file to read the content of the file
throws:
  java.io.FileNotFoundException - if the file does not exist or is a directory
throws:
  java.io.IOException - if any I/O error occours



readFile
public static String readFile(File file) throws java.io.IOException(Code)
Read file filename and return the content as String
Parameters:
  file - the file to read the content of the file
throws:
  java.io.FileNotFoundException - if the file does not exist or is a directory
throws:
  java.io.IOException - if any I/O error occours



saveFile
public static void saveFile(String file, StringWriter sw) throws java.io.IOException(Code)
Create a new file file from the stream sw
Parameters:
  file - the file to save
Parameters:
  sw - the strem
throws:
  java.io.IOException - if any Exception occurs



saveFile
public static void saveFile(String file, String string) throws java.io.IOException(Code)
Create the file file containg string
Parameters:
  file - the file to save
Parameters:
  string - the content of the file
throws:
  java.io.IOException - if any Exception occurs



saveFile
public static void saveFile(String file, byte[] bytes) throws java.io.IOException(Code)
Create the file file containg bytes
Parameters:
  file - the file to save
Parameters:
  bytes - the content of the file
throws:
  java.io.IOException - if any Exception occurs



saveFile
public static void saveFile(File file, byte[] bytes) throws java.io.IOException(Code)
Create the file file containg bytes
Parameters:
  file - the file to save
Parameters:
  bytes - the content of the file
throws:
  java.io.IOException - if any Exception 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.