Java Doc for FileUtil.java in  » Portal » Open-Portal » com » sun » portal » fabric » 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 » Portal » Open Portal » com.sun.portal.fabric.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.portal.fabric.util.FileUtil

FileUtil
public class FileUtil (Code)


Field Summary
final public static  intAPPEND_ALL_OCCURANCES
    
final public static  intAPPEND_ALL_OCCURANCES_STARTING_WITH
    
final public static  intAPPEND_FIRST_OCCURANCE
    
final public static  intAPPEND_FIRST_OCCURANCE_STARTING_WITH
    
final public static  intDELETE_ALL_OCCURANCES
    
final public static  intDELETE_ALL_OCCURANCES_STARTING_WITH
    
final public static  intDELETE_FIRST_OCCURANCE
    
final public static  intDELETE_FIRST_OCCURANCE_STARTING_WITH
    
final public static  intREPLACED_ALL_OCCURANCES_STARTING_WITH
    
final public static  intREPLACE_ALL_OCCURANCES
    
final public static  intREPLACE_FIRST_OCCURANCE
    
final public static  intREPLACE_FIRST_OCCURANCE_STARTING_WITH
    


Method Summary
public static  booleanappendLineInFile(File file, String pattern, String text)
    
public static  booleanappendLineInFile(File file, String pattern, String text, int mode)
    
public static  booleanappendToFile(File file, String text, boolean checkIfExists)
    
public static  voidchangeFilePermissions(String file, String permissions)
     Changes the permissions of the given file to the given permissions.
public static  voidchangeFilePermissions(File file, String permissions)
     Changes the permissions of the given file to the given permissions.
public static  booleancopyDir(String fromDirName, String toDirName)
    
public static  booleancopyDir(String fromDirName, String toDirName, boolean resolveLinks)
    
public static  booleancopyFile(String fromFilename, String toFilename)
    
public static  booleancopyFile(File fromFile, File toFile)
    
public static  booleancopyFile(File fromFile, File toFile, boolean deleteSourceFile)
    
public static  StringcreatePasswordFile(String data)
    
public static  voiddebug(String str)
    
public static  StringdecoratePath(String path)
    
public static  booleandeleteDir(String dirName)
    
public static  booleandeleteDir(File dir)
    
public static  booleandeleteLineInFile(File file, String pattern)
    
public static  booleandeleteLineInFile(File file, String pattern, int mode)
    
public static  booleandeleteSectionInFile(File file, String start, String end)
     Delete section from start token to end token in file. If start token is not found, so not delete anything. If start token is found, delete every line till end token is found. If end token is not found, do not delete anything. If token is found in line, the entire line is deleted Assume that start and end tokens are in different lines, and end token always appears after start token. Assume that the section appears only once in the file
Parameters:
  file -
Parameters:
  start - - Start token of section.
Parameters:
  end - - End token of section true if section found and deleted.
public static  booleandirectoryExists(String dirName)
    
public static  FileextractFileFromJar(String jarPath, String filePath)
    
public static  FileextractFileFromJar(String jarPath, String filePath, boolean keepFileAfterExist)
    
public static  voidextractJar(String jarPath, String targetPath)
    
public static  StringextractPatternTillEOL(File file, String key, String separator)
    
public static  booleanfileExists(String fileName)
    
public static  StringfindPatternInFile(File file, String pattern)
    
public static  StringfindTextInFile(File file, String text)
    
public static  StringgetAttributeValue(File sXMLFile, String xpath, String attr)
     Read an xml file into an xml document (org.jdom.Document) and return the request attribute value, given an xpath.
public static  FilenameFiltergetExtensionFilter(String ext)
    
public static  booleangetFiles(File dir, List files)
    
public static  booleangetFiles(File dir, List files, String ext)
    
public static  StringgetQuotedKeyValueInText(String key, String text)
    
public static  StringgetRandomDirName()
    
public static  StringgetRandomString()
    
public static  BufferedReadergetUTF8BufferedReader(File fileName)
     Gets Buffered Reader initialized with UTF-8 encoding
Parameters:
  File - Object from which data needs to be read.
public static  BufferedWritergetUTF8BufferedWriter(File fileName)
     Gets Buffered Writer intialized UTF-8 encoding
Parameters:
  File - Object to which data needs to be read.
public static  booleanmakeDir(String dirName)
    
public static  booleanreplaceLineInFile(File file, String pattern, String text)
    
public static  StringreplaceToken(String str, String token, String value)
    
public static  booleanreplaceTokenInFile(File origFile, File newFile, String token, String value)
    
public static  booleanreplaceTokenInFile(File file, String token, String value)
    
public static  booleanreplaceTokensInFile(File file, String[] tokens, String[] values)
    

Field Detail
APPEND_ALL_OCCURANCES
final public static int APPEND_ALL_OCCURANCES(Code)



APPEND_ALL_OCCURANCES_STARTING_WITH
final public static int APPEND_ALL_OCCURANCES_STARTING_WITH(Code)



APPEND_FIRST_OCCURANCE
final public static int APPEND_FIRST_OCCURANCE(Code)



APPEND_FIRST_OCCURANCE_STARTING_WITH
final public static int APPEND_FIRST_OCCURANCE_STARTING_WITH(Code)



DELETE_ALL_OCCURANCES
final public static int DELETE_ALL_OCCURANCES(Code)



DELETE_ALL_OCCURANCES_STARTING_WITH
final public static int DELETE_ALL_OCCURANCES_STARTING_WITH(Code)



DELETE_FIRST_OCCURANCE
final public static int DELETE_FIRST_OCCURANCE(Code)



DELETE_FIRST_OCCURANCE_STARTING_WITH
final public static int DELETE_FIRST_OCCURANCE_STARTING_WITH(Code)



REPLACED_ALL_OCCURANCES_STARTING_WITH
final public static int REPLACED_ALL_OCCURANCES_STARTING_WITH(Code)



REPLACE_ALL_OCCURANCES
final public static int REPLACE_ALL_OCCURANCES(Code)



REPLACE_FIRST_OCCURANCE
final public static int REPLACE_FIRST_OCCURANCE(Code)



REPLACE_FIRST_OCCURANCE_STARTING_WITH
final public static int REPLACE_FIRST_OCCURANCE_STARTING_WITH(Code)





Method Detail
appendLineInFile
public static boolean appendLineInFile(File file, String pattern, String text)(Code)



appendLineInFile
public static boolean appendLineInFile(File file, String pattern, String text, int mode)(Code)



appendToFile
public static boolean appendToFile(File file, String text, boolean checkIfExists)(Code)



changeFilePermissions
public static void changeFilePermissions(String file, String permissions)(Code)
Changes the permissions of the given file to the given permissions. On UNIX systems, permissions can either be in string (symbolic) mode or octal numbers. However, on Microsoft Windows systems, permissions must be in octal numbers. In addition, group and other permissions must not be set (i.e. permssions must be in the form "x00").
Parameters:
  file - the file where its permssions are to be changed.
Parameters:
  permissions - the permssions of the file to be changed to.



changeFilePermissions
public static void changeFilePermissions(File file, String permissions)(Code)
Changes the permissions of the given file to the given permissions. On UNIX systems, permissions can either be in string (symbolic) mode or octal numbers. However, on Microsoft Windows systems, permissions must be in octal numbers. In addition, group and other permissions must not be set (i.e. permssions must be in the form "x00").
Parameters:
  file - the file where its permssions are to be changed.
Parameters:
  permissions - the permssions of the file to be changed to.



copyDir
public static boolean copyDir(String fromDirName, String toDirName)(Code)



copyDir
public static boolean copyDir(String fromDirName, String toDirName, boolean resolveLinks)(Code)



copyFile
public static boolean copyFile(String fromFilename, String toFilename)(Code)



copyFile
public static boolean copyFile(File fromFile, File toFile)(Code)



copyFile
public static boolean copyFile(File fromFile, File toFile, boolean deleteSourceFile)(Code)



createPasswordFile
public static String createPasswordFile(String data)(Code)
Creates a file of random name after writing the data



debug
public static void debug(String str)(Code)
Public methods



decoratePath
public static String decoratePath(String path)(Code)



deleteDir
public static boolean deleteDir(String dirName)(Code)



deleteDir
public static boolean deleteDir(File dir)(Code)



deleteLineInFile
public static boolean deleteLineInFile(File file, String pattern)(Code)



deleteLineInFile
public static boolean deleteLineInFile(File file, String pattern, int mode)(Code)



deleteSectionInFile
public static boolean deleteSectionInFile(File file, String start, String end)(Code)
Delete section from start token to end token in file. If start token is not found, so not delete anything. If start token is found, delete every line till end token is found. If end token is not found, do not delete anything. If token is found in line, the entire line is deleted Assume that start and end tokens are in different lines, and end token always appears after start token. Assume that the section appears only once in the file
Parameters:
  file -
Parameters:
  start - - Start token of section.
Parameters:
  end - - End token of section true if section found and deleted. false otherwise.



directoryExists
public static boolean directoryExists(String dirName)(Code)



extractFileFromJar
public static File extractFileFromJar(String jarPath, String filePath) throws IOException, FileNotFoundException(Code)



extractFileFromJar
public static File extractFileFromJar(String jarPath, String filePath, boolean keepFileAfterExist) throws IOException, FileNotFoundException(Code)



extractJar
public static void extractJar(String jarPath, String targetPath) throws IOException(Code)



extractPatternTillEOL
public static String extractPatternTillEOL(File file, String key, String separator)(Code)



fileExists
public static boolean fileExists(String fileName)(Code)



findPatternInFile
public static String findPatternInFile(File file, String pattern)(Code)
Returns first line in file that matches pattern If pattern not found returns null
Parameters:
  file -
Parameters:
  pattern - - regex defining pattern to be matched



findTextInFile
public static String findTextInFile(File file, String text)(Code)



getAttributeValue
public static String getAttributeValue(File sXMLFile, String xpath, String attr)(Code)
Read an xml file into an xml document (org.jdom.Document) and return the request attribute value, given an xpath.



getExtensionFilter
public static FilenameFilter getExtensionFilter(String ext)(Code)



getFiles
public static boolean getFiles(File dir, List files)(Code)



getFiles
public static boolean getFiles(File dir, List files, String ext)(Code)



getQuotedKeyValueInText
public static String getQuotedKeyValueInText(String key, String text)(Code)
Searches for key with quoted value in text and returns value
Parameters:
  key -
Parameters:
  text - value without quotes



getRandomDirName
public static String getRandomDirName()(Code)
a random number string which is 8 digits or less in length



getRandomString
public static String getRandomString()(Code)
a random number string which is 8 digits or less in length



getUTF8BufferedReader
public static BufferedReader getUTF8BufferedReader(File fileName)(Code)
Gets Buffered Reader initialized with UTF-8 encoding
Parameters:
  File - Object from which data needs to be read. BufferedReader Object initialized with UTF-8 encoding



getUTF8BufferedWriter
public static BufferedWriter getUTF8BufferedWriter(File fileName)(Code)
Gets Buffered Writer intialized UTF-8 encoding
Parameters:
  File - Object to which data needs to be read. BufferedWriter Object initialized with UTF-8 encoding



makeDir
public static boolean makeDir(String dirName)(Code)



replaceLineInFile
public static boolean replaceLineInFile(File file, String pattern, String text)(Code)



replaceToken
public static String replaceToken(String str, String token, String value)(Code)



replaceTokenInFile
public static boolean replaceTokenInFile(File origFile, File newFile, String token, String value)(Code)



replaceTokenInFile
public static boolean replaceTokenInFile(File file, String token, String value)(Code)



replaceTokensInFile
public static boolean replaceTokensInFile(File file, String[] tokens, String[] values)(Code)



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.