Java Doc for FileManager.java in  » Content-Management-System » TransferCM » com » methodhead » res » 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 » Content Management System » TransferCM » com.methodhead.res 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.methodhead.res.FileManager

FileManager
public class FileManager (Code)
Provides a logical file system and methods to manage it.


Field Summary
final public static  StringVALIDATE_CANTOVERWRITE
     The move or copy would result in overwriting a directory or overwriting a file with a directory.
final public static  StringVALIDATE_INVALIDDESTNAME
     The destination file name is invalid.
final public static  StringVALIDATE_INVALIDDESTPATH
     The destination path is blank, invalid (e.g., contains ".."), or non-existant.
final public static  StringVALIDATE_SUBDIROFSELF
     The destination path is a subdirectory of one of the files being moved or copied.
protected  Mapdirectories_
    


Method Summary
public  voidaddDirectory(String name, File dir)
     Adds a directory to the file system.
protected  booleancanOverwrite(File src, File dest)
     Returns true if src can overwrite dest.
protected  booleancanOverwrite(File dest, boolean isDir)
     Returns true if dest can be overwritten by a file, where isDir specifies whether that file is a file or a directory.
public  voidcopy(String srcPath, String[] srcFiles, String destPath, String destFile)
     Copies the files specified by srcPath and srcFiles to destPath.
protected static  voidcopyFile(File from, File to)
     Copies from to to; if from is a directory, it is recursively copied.
public  voidcreate(String path, String file, boolean isDir)
     Creates the file specified by srcPath and srcFile; a directory is created if isDir is true, otherwise an empty file is created.
public  voidcreate(String path, String file, InputStream in)
     Creates the file specified by srcPath and srcFile, writing the contents of in to the file.
public  voiddelete(String srcPath, String[] srcFiles)
     Deletes the files specified by srcPath and srcFiles.
public  String[]findOverwriteFiles(String srcPath, String[] srcFiles, String destPath, String destFile)
     Returns the names of files in destPath that would be overwritten by files specified by srcPath and srcFiles in a move or copy operation.
public  Directory[]getDirectories()
     Returns the directories being managed by the file manager, sorted by the directory name.
public  FilegetFile(String path, String name)
     Returns the file specified by path and name, or null if no such file exists.
protected  FilegetFileForPath(String path)
     Returns the directory specified by path, or null if no such directory (if a file exists, but is not a directory, null is still returned).
public  File[]getFiles(String path)
     Returns the files in the directory specified by path, sorted in alphabetical order, or null if no such path exists.
public  FilegetNewFile(String path, String name)
     Returns a file specified by path and name, such that the returned file can be used to create a new file.
protected  booleanisDestSubdir(String srcPath, String[] srcFiles, String destPath)
     Returns true if destPath is a subdirectory of any files specified by srcPath and srcFiles.
public  voidmove(String srcPath, String[] srcFiles, String destPath, String destFile)
     Moves the files specified by srcPath and srcFiles to destPath.
public  StringvalidateCreate(String srcPath, String srcFile, boolean isDir)
     Validates whether the files specified by srcPath and srcFile can be created.
public  StringvalidateMove(String srcPath, String[] srcFiles, String destPath, String destFile)
     Validates moving srcFiles from srcPath to destPath.

Field Detail
VALIDATE_CANTOVERWRITE
final public static String VALIDATE_CANTOVERWRITE(Code)
The move or copy would result in overwriting a directory or overwriting a file with a directory.



VALIDATE_INVALIDDESTNAME
final public static String VALIDATE_INVALIDDESTNAME(Code)
The destination file name is invalid.



VALIDATE_INVALIDDESTPATH
final public static String VALIDATE_INVALIDDESTPATH(Code)
The destination path is blank, invalid (e.g., contains ".."), or non-existant.



VALIDATE_SUBDIROFSELF
final public static String VALIDATE_SUBDIROFSELF(Code)
The destination path is a subdirectory of one of the files being moved or copied.



directories_
protected Map directories_(Code)





Method Detail
addDirectory
public void addDirectory(String name, File dir) throws ResException(Code)
Adds a directory to the file system. An exception is thrown if dir is not a valid directory, or if a directory named name has already been added.



canOverwrite
protected boolean canOverwrite(File src, File dest)(Code)
Returns true if src can overwrite dest. Directories cannot be overwritten at all, and files can't be overwritten by directories.



canOverwrite
protected boolean canOverwrite(File dest, boolean isDir)(Code)
Returns true if dest can be overwritten by a file, where isDir specifies whether that file is a file or a directory. If dest is null, it is assumed the file doesn't exist, and true is returned. The same rules described in FileManager.canOverwrite(java.io.File,java.io.File) apply.



copy
public void copy(String srcPath, String[] srcFiles, String destPath, String destFile)(Code)
Copies the files specified by srcPath and srcFiles to destPath. If srcFiles contains exactly one file name, destFile is used as the destination file name. Any directories are recursively copied.



copyFile
protected static void copyFile(File from, File to) throws ResException(Code)
Copies from to to; if from is a directory, it is recursively copied. If to is exists and is not a directory, it is overwritten. If to is exists and is a directory, the contents of from are copied over the contents of to. If to exists, but is a directory when from is not (or vice versa), an exception is thrown.



create
public void create(String path, String file, boolean isDir)(Code)
Creates the file specified by srcPath and srcFile; a directory is created if isDir is true, otherwise an empty file is created. If the file exists, an a file is being created, the existing file is overwritten.



create
public void create(String path, String file, InputStream in)(Code)
Creates the file specified by srcPath and srcFile, writing the contents of in to the file. If the file exists, the existing file is overwritten.



delete
public void delete(String srcPath, String[] srcFiles)(Code)
Deletes the files specified by srcPath and srcFiles. An exception is thrown if file(s) do not already exist.



findOverwriteFiles
public String[] findOverwriteFiles(String srcPath, String[] srcFiles, String destPath, String destFile)(Code)
Returns the names of files in destPath that would be overwritten by files specified by srcPath and srcFiles in a move or copy operation. If srcFiles contains only one file name, destFile is considered the destination file name.



getDirectories
public Directory[] getDirectories()(Code)
Returns the directories being managed by the file manager, sorted by the directory name.



getFile
public File getFile(String path, String name) throws ResException(Code)
Returns the file specified by path and name, or null if no such file exists.



getFileForPath
protected File getFileForPath(String path) throws ResException(Code)
Returns the directory specified by path, or null if no such directory (if a file exists, but is not a directory, null is still returned).



getFiles
public File[] getFiles(String path) throws ResException(Code)
Returns the files in the directory specified by path, sorted in alphabetical order, or null if no such path exists.



getNewFile
public File getNewFile(String path, String name) throws ResException(Code)
Returns a file specified by path and name, such that the returned file can be used to create a new file. An exception is thrown if the file already exists.



isDestSubdir
protected boolean isDestSubdir(String srcPath, String[] srcFiles, String destPath)(Code)
Returns true if destPath is a subdirectory of any files specified by srcPath and srcFiles.



move
public void move(String srcPath, String[] srcFiles, String destPath, String destFile)(Code)
Moves the files specified by srcPath and srcFiles to destPath. If srcFiles contains exactly one file name, destFile is used as the destination file name.



validateCreate
public String validateCreate(String srcPath, String srcFile, boolean isDir)(Code)
Validates whether the files specified by srcPath and srcFile can be created. A file may not be created in some circumstances: if the file exists and is a directory, it cannot be overwritten; if the file exists and is a normal file, it cannot be overwritten by a directory. Returns null if the create is valid. A VALIDATE_ (e.g. FileManager.VALIDATE_CANTOVERWRITE ) error code is returned if the create is invalid. Note that these error codes are designed to be used as a key in a resource bundle.



validateMove
public String validateMove(String srcPath, String[] srcFiles, String destPath, String destFile)(Code)
Validates moving srcFiles from srcPath to destPath. srcFiles is expected to contain a list of file names as Strings. If srcFiles contains a single file name, destFile is validated as a destination file name. Returns null if the move is valid. A VALIDATE_ (e.g. FileManager.VALIDATE_INVALIDDESTPATH ) error code is returned if the move is invalid. Note that these error codes are designed to be used as a key in a resource bundle.



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.