Java Doc for FileUtils.java in  » IDE » tIDE » snow » utils » storage » 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 » IDE » tIDE » snow.utils.storage 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   snow.utils.storage.FileUtils

FileUtils
final public class FileUtils (Code)
All file access should be done from here

Inner Class :final static class JavaFileNameFilter implements FileFilter
Inner Class :final static class ClassFileNameFilter implements FileFilter
Inner Class :final static class FolderFileNameFilter implements FileFilter

Field Summary
final public static  ClassFileNameFilterclassFileNameFilter
    
final public static  FolderFileNameFilterfolderFileNameFilter
     Folders only.
static  DecimalFormatformat0
    
final static  JavaFileNameFilterjavaFileNameFilter
    


Method Summary
public static  voidaddToZip(ZipOutputStream zos, File f, String relName)
    
public static  voidaddToZip(org.apache.tools.zip.ZipOutputStream zos, File f, String relName)
     better char encoding (correct charset). can also handle attributes (readonly) ...
public static  voidcloseIgnoringExceptions(Closeable c)
     works fine.
public static  voidcloseIgnoringExceptions(JarFile c)
    
public static  voidcloseIgnoringExceptions(ZipFile c)
    
public static  voidcopy(File source, File dest)
    
public static  voidextractZipFile(File file, File destFold, ProgressModalDialog pmd)
     Double buffered extracter, pmd used for cancel.
public static  StringfilesToList(List<File> files)
     a "; "separated list or the absolute file paths.Be careful, some apps don't want the space.
public static  StringformatSize(long s)
    
public static  voidgetAllClassFilesRecurse(File root, List<File> allFiles, boolean ignoringDirsStartingWithDot)
    
public static  voidgetAllFilesRecurse(File root, List<File> allFiles, boolean withDirectories, boolean ignoringDirsStartingWithDot)
     if withDirectories, append also the directories Remark: the root is not added.
public static  voidgetAllFilesRecurseLim(File root, List<File> allFiles, boolean withDirectories, boolean ignoringDirsStartingWithDot, int maxDepth, ProgressModalDialog pmd)
     Version with limited recursion depth.
public static  voidgetAllJavaFilesRecurse(File root, List<File> allFiles, boolean withFolders, boolean ignoringDirsStartingWithDot)
    
public static  List<File>getAllResourceFilesRecurse(File root, List<String> ignoredEndingsLow)
    
public static  FilegetCanonicalFileWithCase(File f)
     just calls the File.getCanonicalFile().
public static  StringgetCanonicalName(File f)
     With / as separator and a / at the end for directories CAUTION: case is NOT canonicalized.
public static  StringgetExtension(String fileName)
     Also called suffix, the text after the last dot.
public static  byte[]getFileByteContent(File file)
    
public static  StringgetFileStringContent(File file)
    
public static  List<File>getFilesFromList(String list, boolean onlyExisting)
    
public static  List<File>getFilesOnly_notRecurse(File root)
    
public static  voidgetFoldersRecurse(File root, List<File> allFiles, boolean ignoringDirsStartingWithDot)
     With the root itself.
public static  intgetNumberOfFiles(File root)
     Recurse into root, but don't counts directories.
public static  longgetSizeIncludingSubFiles(File root)
    
public static  StringgetStringContent(InputStream is)
    
public static  voidgunzip(File in, File out)
    
public static  StorageVectorloadVector(InputStream is)
     Loads the vector from the inputstream.
public static  StorageVectorloadVectorFromFile(File file)
    
public static  StorageVectorloadVectorFromFile(File file, boolean faultTolerant)
    
public static  StorageVectorloadVectorWithoutClose(InputStream is)
     Caution: the stream is not closed, this allow you to read several vectory from the stream a header and a body, for example.
public static  StorageVectorloadZippedVectorFromFile3(File file)
     Works...
public static  FileremoveRelativePaths(File f)
    
public static  voidsaveBytesToFile(byte[] cont, File file)
    
public static  voidsaveToFile(String cont, File file)
    
public static  voidsaveVectorToFile(File file, List<Object> v)
     creates the folders if needed...
public static  voidsaveZippedVectorToFile(File file, List<Object> v)
    
static  voidskipFully(InputStream in, long nBytes)
     From Gatfer more Puzzlers...
public static  voidwriteToFile(InputStream is, File file)
    

Field Detail
classFileNameFilter
final public static ClassFileNameFilter classFileNameFilter(Code)



folderFileNameFilter
final public static FolderFileNameFilter folderFileNameFilter(Code)
Folders only.



format0
static DecimalFormat format0(Code)



javaFileNameFilter
final static JavaFileNameFilter javaFileNameFilter(Code)





Method Detail
addToZip
public static void addToZip(ZipOutputStream zos, File f, String relName) throws Exception(Code)



addToZip
public static void addToZip(org.apache.tools.zip.ZipOutputStream zos, File f, String relName) throws Exception(Code)
better char encoding (correct charset). can also handle attributes (readonly) ... NOT made.



closeIgnoringExceptions
public static void closeIgnoringExceptions(Closeable c)(Code)
works fine. (but passes through an external file). public static void test() throws Exception { File gzfile = new File("c:/temp/abc.txt.gz"); GZIPOutputStream gzos = new GZIPOutputStream(new FileOutputStream(gzfile)); byte[] bh = "Hello world !".getBytes(); System.out.println(""+Arrays.toString(bh)); gzos.write(bh); gzos.finish(); gzos.flush(); gzos.close(); GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(gzfile)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buf = new byte[256]; int read = 0; while((read=gzis.read(buf))!=-1) { baos.write(buf,0,read); } System.out.println("bh2"+ Arrays.toString(baos.toByteArray())); }



closeIgnoringExceptions
public static void closeIgnoringExceptions(JarFile c)(Code)



closeIgnoringExceptions
public static void closeIgnoringExceptions(ZipFile c)(Code)



copy
public static void copy(File source, File dest) throws Exception(Code)



extractZipFile
public static void extractZipFile(File file, File destFold, ProgressModalDialog pmd) throws Exception(Code)
Double buffered extracter, pmd used for cancel.



filesToList
public static String filesToList(List<File> files)(Code)
a "; "separated list or the absolute file paths.Be careful, some apps don't want the space. (just remove it)



formatSize
public static String formatSize(long s)(Code)



getAllClassFilesRecurse
public static void getAllClassFilesRecurse(File root, List<File> allFiles, boolean ignoringDirsStartingWithDot)(Code)



getAllFilesRecurse
public static void getAllFilesRecurse(File root, List<File> allFiles, boolean withDirectories, boolean ignoringDirsStartingWithDot)(Code)
if withDirectories, append also the directories Remark: the root is not added. settings folders, starting with "." are also ignored. in case of folders inclusion, folder are present first to their content, this may be useful when creating a tree... SLOW: getAllJavaFilesRecurse is quicker.



getAllFilesRecurseLim
public static void getAllFilesRecurseLim(File root, List<File> allFiles, boolean withDirectories, boolean ignoringDirsStartingWithDot, int maxDepth, ProgressModalDialog pmd)(Code)
Version with limited recursion depth. maxDepth=0 => only files.



getAllJavaFilesRecurse
public static void getAllJavaFilesRecurse(File root, List<File> allFiles, boolean withFolders, boolean ignoringDirsStartingWithDot)(Code)



getAllResourceFilesRecurse
public static List<File> getAllResourceFilesRecurse(File root, List<String> ignoredEndingsLow)(Code)
All files but not the files ending with the given names



getCanonicalFileWithCase
public static File getCanonicalFileWithCase(File f)(Code)
just calls the File.getCanonicalFile(). The cases are corrected and ".." are "resolved". Should be called on each file object that is compared ! Be very careful, E: and e: are denoting the same path on windows, but they string are not "equals"



getCanonicalName
public static String getCanonicalName(File f)(Code)
With / as separator and a / at the end for directories CAUTION: case is NOT canonicalized. call first getCanonicalFileWithCase() on the file !



getExtension
public static String getExtension(String fileName)(Code)
Also called suffix, the text after the last dot. If none, returns the whole name. Makes sense on linux, where files named path/to/prop are often seen. So we had a "prop" file.



getFileByteContent
public static byte[] getFileByteContent(File file) throws Exception(Code)



getFileStringContent
public static String getFileStringContent(File file) throws Exception(Code)



getFilesFromList
public static List<File> getFilesFromList(String list, boolean onlyExisting)(Code)



getFilesOnly_notRecurse
public static List<File> getFilesOnly_notRecurse(File root)(Code)



getFoldersRecurse
public static void getFoldersRecurse(File root, List<File> allFiles, boolean ignoringDirsStartingWithDot)(Code)
With the root itself.



getNumberOfFiles
public static int getNumberOfFiles(File root)(Code)
Recurse into root, but don't counts directories.



getSizeIncludingSubFiles
public static long getSizeIncludingSubFiles(File root)(Code)



getStringContent
public static String getStringContent(InputStream is) throws Exception(Code)



gunzip
public static void gunzip(File in, File out) throws Exception(Code)



loadVector
public static StorageVector loadVector(InputStream is) throws Exception(Code)
Loads the vector from the inputstream. Closes the input stream at end



loadVectorFromFile
public static StorageVector loadVectorFromFile(File file) throws Exception(Code)



loadVectorFromFile
public static StorageVector loadVectorFromFile(File file, boolean faultTolerant) throws Exception(Code)



loadVectorWithoutClose
public static StorageVector loadVectorWithoutClose(InputStream is) throws Exception(Code)
Caution: the stream is not closed, this allow you to read several vectory from the stream a header and a body, for example.



loadZippedVectorFromFile3
public static StorageVector loadZippedVectorFromFile3(File file) throws Exception(Code)
Works... but not perfect, not "on the fly". Needs a fully unpack.



removeRelativePaths
public static File removeRelativePaths(File f)(Code)
remove the ".." in the path (resolve them!)



saveBytesToFile
public static void saveBytesToFile(byte[] cont, File file) throws Exception(Code)



saveToFile
public static void saveToFile(String cont, File file) throws Exception(Code)



saveVectorToFile
public static void saveVectorToFile(File file, List<Object> v) throws Exception(Code)
creates the folders if needed...



saveZippedVectorToFile
public static void saveZippedVectorToFile(File file, List<Object> v) throws Exception(Code)



skipFully
static void skipFully(InputStream in, long nBytes) throws IOException(Code)
From Gatfer more Puzzlers...



writeToFile
public static void writeToFile(InputStream is, File file) throws Exception(Code)

Parameters:
  is - is closed in all situations.



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.