Java Doc for FileUtility.java in  » Development » jfig » org » igfay » 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 » Development » jfig » org.igfay.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.igfay.util.FileUtility

FileUtility
public class FileUtility (Code)
Helper methods for working with File objects
author:
   bconrad


Field Summary
protected static  Loggerlog
    


Method Summary
public static  voidcloseStreams(InputStream inputStream, OutputStream outputStream)
     Close the provided input and output streams.
public static  StringcontentsOfFile(File file)
    
public static  StringcontentsOfFile(String fileName)
    
public static  voidcopy(File inFile, File outFile)
    
public static  voidcopy(InputStream in, OutputStream out)
    
public static  booleanensureFilePathExists(File file)
     Ensure that the provided file exists.
public static  booleanensureFilePathExists(String fileString)
     Ensure that the provided file name exists.
public static  booleanensurePathExists(File file)
     Ensure that the path to the provided file exists.
public static  booleanensurePathExists(String fileString)
     Ensure that the path to the provided file name exists.
public static  FilefindExistingFile(String fileName)
     Return a File for an existing file.
public static  java.io.BufferedReadergetBufferedReaderFromFile(File file)
    
public static  java.io.BufferedReadergetBufferedReaderFromFile(String fileString)
    
public static  StringgetExceptionMessage(Exception e, File file)
    
public static  StringgetLogFileName()
     Return the name of the log file.
public static  voiditeratorToFile(Iterator it, String fileName)
     Write the provided iterator to a file of the provided file name.
public static  PrintStreamnewPrintStreamOnFileNamed(File directory, String name)
    
public static  PrintWriternewPrintWriterOnFileNamed(File directory, String name)
     Create and return a PrintWriter for the provided directory and file name.
public static  ObjectreadObjectFromBufferedFileObject(File file)
     Convert the provided File into a BufferedInputStream.
public static  ObjectreadObjectFromFile(File file)
     Read the provded file and return the contents as an Object.
public static  ObjectreadObjectFromFile(File directory, String name)
     Read the contents of the provided file name residing in the provided directory.
public static  ObjectreadObjectFromFileWithPath(String fileWithPath)
     Read the contents of the provided file name residing in the provided directory.
public static  voidredirectStandardOutput()
     Redirect standard output to the log file.
public static  voidredirectStandardOutput(File file)
     Redirect standard output to the provided File.
public static  voidredirectStandardOutput(String fileName)
     Redirect standard output to the provided file name.
public static  StringstreamToString(InputStream inputStream)
    
public static  StringstringFromFile(File file)
     Return the contents of the provided file as a String.
public static  StringstringFromFile(String fileName)
     Return the contents of the provided file name as a String.
public static  voidstringToFile(String string, File file)
     Convert the provided String into the provided File.
public static  voidstringToFile(String string, String fileString)
     Convert the provided String into a File of the provided file name.
public static  voidstringToFileOutputStream(String string, FileOutputStream fos)
     Convert the provided String into the provided FileOutputStream.
public static  voidwriteObjectToFile(Object object, File directory, String name)
     Write the provided object to a file of the provided directory and file name.
public static  voidwriteObjectToFileObject(Object object, File file)
     Write the provided object to the provided File.
public static  voidwriteObjectToFileWithPath(Object object, String fileAndPath)
     Write the provided object to the provided file name.

Field Detail
log
protected static Logger log(Code)





Method Detail
closeStreams
public static void closeStreams(InputStream inputStream, OutputStream outputStream)(Code)
Close the provided input and output streams. Ignore any exception.
Parameters:
  inputStream -
Parameters:
  outputStream -



contentsOfFile
public static String contentsOfFile(File file)(Code)
Return the contents of the provided File as a String
Parameters:
  file -



contentsOfFile
public static String contentsOfFile(String fileName)(Code)
Return the contents of the provided file name as a String
Parameters:
  fileName -



copy
public static void copy(File inFile, File outFile) throws IOException(Code)



copy
public static void copy(InputStream in, OutputStream out) throws IOException(Code)



ensureFilePathExists
public static boolean ensureFilePathExists(File file)(Code)
Ensure that the provided file exists. If it does not, create it along with any necessary directories in the path.
Parameters:
  file -



ensureFilePathExists
public static boolean ensureFilePathExists(String fileString)(Code)
Ensure that the provided file name exists. If it does not, create it along with any necessary directories in the path.
Parameters:
  fileString -



ensurePathExists
public static boolean ensurePathExists(File file)(Code)
Ensure that the path to the provided file exists. If it does not, create it.
Parameters:
  file -



ensurePathExists
public static boolean ensurePathExists(String fileString)(Code)
Ensure that the path to the provided file name exists. If it does not, create it.
Parameters:
  fileString -



findExistingFile
public static File findExistingFile(String fileName)(Code)
Return a File for an existing file. If we can't find it by the fileName, find it in the classpath. If that fails, return null.
Parameters:
  fileName -



getBufferedReaderFromFile
public static java.io.BufferedReader getBufferedReaderFromFile(File file) throws FileNotFoundException(Code)
Return the provided File as a BufferedReader
Parameters:
  file -
throws:
  FileNotFoundException -



getBufferedReaderFromFile
public static java.io.BufferedReader getBufferedReaderFromFile(String fileString) throws FileNotFoundException(Code)
Return the provided file name as a BufferedReader
Parameters:
  fileString -
throws:
  FileNotFoundException -



getExceptionMessage
public static String getExceptionMessage(Exception e, File file)(Code)



getLogFileName
public static String getLogFileName()(Code)
Return the name of the log file.



iteratorToFile
public static void iteratorToFile(Iterator it, String fileName) throws IOException(Code)
Write the provided iterator to a file of the provided file name.
Parameters:
  it -
Parameters:
  fileName -
throws:
  IOException -



newPrintStreamOnFileNamed
public static PrintStream newPrintStreamOnFileNamed(File directory, String name) throws IOException(Code)



newPrintWriterOnFileNamed
public static PrintWriter newPrintWriterOnFileNamed(File directory, String name) throws IOException(Code)
Create and return a PrintWriter for the provided directory and file name.
Parameters:
  directory -
Parameters:
  name -
throws:
  IOException -



readObjectFromBufferedFileObject
public static Object readObjectFromBufferedFileObject(File file) throws IOException, ClassNotFoundException(Code)
Convert the provided File into a BufferedInputStream. Then read the stream and return the Object that was read.
Parameters:
  file -
throws:
  IOException -
throws:
  ClassNotFoundException -



readObjectFromFile
public static Object readObjectFromFile(File file) throws IOException, ClassNotFoundException(Code)
Read the provded file and return the contents as an Object.
Parameters:
  file - java.lang.String java.lang.Object
exception:
  IOException - Description of Exception
exception:
  ClassNotFoundException - Description of Exception



readObjectFromFile
public static Object readObjectFromFile(File directory, String name) throws IOException, ClassNotFoundException(Code)
Read the contents of the provided file name residing in the provided directory. Return the contents as an Object.
Parameters:
  directory -
Parameters:
  name - java.lang.Object
exception:
  IOException -
exception:
  ClassNotFoundException -



readObjectFromFileWithPath
public static Object readObjectFromFileWithPath(String fileWithPath) throws IOException, ClassNotFoundException(Code)
Read the contents of the provided file name residing in the provided directory. Return the contents as an Object.
Parameters:
  fileWithPath -
throws:
  IOException -
throws:
  ClassNotFoundException -



redirectStandardOutput
public static void redirectStandardOutput()(Code)
Redirect standard output to the log file.



redirectStandardOutput
public static void redirectStandardOutput(File file)(Code)
Redirect standard output to the provided File.
Parameters:
  file -



redirectStandardOutput
public static void redirectStandardOutput(String fileName)(Code)
Redirect standard output to the provided file name.
Parameters:
  file -



streamToString
public static String streamToString(InputStream inputStream)(Code)
Return the provided InputStream as a String
Parameters:
  inputStream -



stringFromFile
public static String stringFromFile(File file)(Code)
Return the contents of the provided file as a String.
Parameters:
  file -



stringFromFile
public static String stringFromFile(String fileName)(Code)
Return the contents of the provided file name as a String.
Parameters:
  file -



stringToFile
public static void stringToFile(String string, File file)(Code)
Convert the provided String into the provided File.
Parameters:
  string -
Parameters:
  file -



stringToFile
public static void stringToFile(String string, String fileString)(Code)
Convert the provided String into a File of the provided file name.
Parameters:
  string -
Parameters:
  file -



stringToFileOutputStream
public static void stringToFileOutputStream(String string, FileOutputStream fos) throws IOException(Code)
Convert the provided String into the provided FileOutputStream.
Parameters:
  string -
Parameters:
  fos -
throws:
  IOException -



writeObjectToFile
public static void writeObjectToFile(Object object, File directory, String name) throws IOException(Code)
Write the provided object to a file of the provided directory and file name.
Parameters:
  object -
Parameters:
  directory -
Parameters:
  name -
throws:
  IOException -



writeObjectToFileObject
public static void writeObjectToFileObject(Object object, File file) throws IOException(Code)
Write the provided object to the provided File.
Parameters:
  object -
Parameters:
  file -
throws:
  IOException -



writeObjectToFileWithPath
public static void writeObjectToFileWithPath(Object object, String fileAndPath) throws IOException(Code)
Write the provided object to the provided file name.
Parameters:
  object -
Parameters:
  fileAndPath -
throws:
  IOException -



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.