Java Doc for FileResource.java in  » J2EE » Pustefix » de » schlund » pfixxml » resources » 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 » J2EE » Pustefix » de.schlund.pfixxml.resources 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


de.schlund.pfixxml.resources.FileResource

FileResource
public interface FileResource extends Comparable<FileResource>(Code)
Provides access to files. This interface is similar to the java.io.File object, but is more flexible. You usually should not create your own classes implementing this interface but use the de.schlund.pfixxml.resources.ResourceUtil class to retrieve instances of this class. Note that depending on the system state, some methods might not be available, especially methods which modify a resource. These methods will then behave like being used on a file that is not writable. Note also the special behaviour of the FileResource.lastModified() method which is different from the behaviour of the corresponding method in the File class.
See Also:   de.schlund.pfixxml.resources.ResourceUtil
author:
   Sebastian Marsching




Method Summary
 booleancanRead()
     Tests whether the application can read the resource denoted by this object.
 booleancanWrite()
     Tests whether the application can modify the resource denoted by this object.
 booleancreateNewFile()
     Atomically creates a new, empty file resource identified by this object if and only if a file with this name does not yet exist.
 booleandelete()
     Deletes the file or directory denoted by this file resource.
 booleanexists()
     Tests whether the file or directory denoted by this file resource exists.
 InputStreamgetInputStream()
     Returns a stream which can be used for reading the content of the resource denoted by this object.
 StringgetName()
     Returns the name of the file or directory denoted by this file resource. This is just the last name in the pathname's name sequence.
 OutputStreamgetOutputStream()
     Returns a which can be used for writing to the resource denoted by this object.
 OutputStreamgetOutputStream(boolean append)
    
 FileResourcegetParentAsFileResource()
     Returns the file resource matching this file resource's parent, or null if this file resource does not have a parent directory.

The parent of an file resource consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last.

 booleanisDirectory()
     Tests whether the resource denoted by this file resource is a directory.
 booleanisFile()
     Tests whether the file denoted by this object is a normal file.
 booleanisHidden()
     Tests whether the file named by this file resource is a hidden file.
 longlastModified()
     Returns the time that the file denoted by this resource was last modified.
 String[]list()
     Returns an array of strings naming the files and directories in the directory denoted by this resource.

If this resource does not denote a directory, then this method returns null.

 FileResource[]listFileResources()
     Returns an array of file resource denoting the files in the directory denoted by this file resource.

If this file resource does not denote a directory, then this method returns null.

 booleanmkdir()
     Creates the directory named by this file resource.
 booleanmkdirs()
     Creates the directory named by this file resource, including any necessary but nonexistent parent directories.
 URItoURI()
    
 URLtoURL()
     Returns an URL which can be used in order to access the file donoted by this object.



Method Detail
canRead
boolean canRead()(Code)
Tests whether the application can read the resource denoted by this object. true if and only if the resource specified by thisobject exists and can be read by the application; false otherwise



canWrite
boolean canWrite()(Code)
Tests whether the application can modify the resource denoted by this object. true if and only if the resource denoted by this object exists and the application is allowed to write to the resource; false otherwise.



createNewFile
boolean createNewFile() throws IOException(Code)
Atomically creates a new, empty file resource identified by this object if and only if a file with this name does not yet exist. The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file.

Note: this method should not be used for file-locking, as the resulting protocol cannot be made to work reliably. The java.nio.channels.FileLock FileLock facility should be used instead. true if the named file does not exist and wassuccessfully created; false if the named filealready exists
throws:
  IOException - If an I/O error occurred




delete
boolean delete()(Code)
Deletes the file or directory denoted by this file resource. If this resource denotes a directory, then the directory must be empty in order to be deleted. true if and only if the file or directory issuccessfully deleted; false otherwise



exists
boolean exists()(Code)
Tests whether the file or directory denoted by this file resource exists. true if and only if the file or directory denotedby this file resource exists; false otherwise



getInputStream
InputStream getInputStream() throws FileNotFoundException(Code)
Returns a stream which can be used for reading the content of the resource denoted by this object. stream for reading the resource
throws:
  FileNotFoundException - if resource cannot be found or read



getName
String getName()(Code)
Returns the name of the file or directory denoted by this file resource. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned. The name of the file or directory denoted by this file resource, or the empty string if this resource's name sequenceis empty



getOutputStream
OutputStream getOutputStream() throws FileNotFoundException(Code)
Returns a which can be used for writing to the resource denoted by this object. stream for writing to the resource
throws:
  FileNotFoundException - if resource cannot be found or is readonly



getOutputStream
OutputStream getOutputStream(boolean append) throws FileNotFoundException(Code)



getParentAsFileResource
FileResource getParentAsFileResource()(Code)
Returns the file resource matching this file resource's parent, or null if this file resource does not have a parent directory.

The parent of an file resource consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory. The file resource matching the parent directory named by thisfile resource, or null if this file resourcedoes not name a parent
since:
   1.2




isDirectory
boolean isDirectory()(Code)
Tests whether the resource denoted by this file resource is a directory. true if and only if the resource denoted by thisobject exists and is a directory;false otherwise



isFile
boolean isFile()(Code)
Tests whether the file denoted by this object is a normal file. A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file. true if and only if the file denoted by thisfile resource exists and is a normal file;false otherwise



isHidden
boolean isHidden()(Code)
Tests whether the file named by this file resource is a hidden file. The exact definition of hidden is system-dependent. On UNIX systems, a file is considered to be hidden if its name begins with a period character ('.'). On Microsoft Windows systems, a file is considered to be hidden if it has been marked as such in the filesystem. true if and only if the file denoted by thisresource is hidden according to the conventions of theunderlying platform



lastModified
long lastModified()(Code)
Returns the time that the file denoted by this resource was last modified. Might return "-1" if the last modified time is not available. A long value representing the time the file waslast modified, measured in milliseconds since the epoch(00:00:00 GMT, January 1, 1970), or 0L if thefile does not exist or if an I/O error occurs



list
String[] list()(Code)
Returns an array of strings naming the files and directories in the directory denoted by this resource.

If this resource does not denote a directory, then this method returns null. Otherwise an array of strings is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order. An array of strings naming the files and directories in thedirectory denoted by this file resource. The array will beempty if the directory is empty. Returns null ifthis file resource does not denote a directory, or if anI/O error occurs.




listFileResources
FileResource[] listFileResources()(Code)
Returns an array of file resource denoting the files in the directory denoted by this file resource.

If this file resource does not denote a directory, then this method returns null. Otherwise an array of FileResource objects is returned, one for each file or directory in the directory. Resources denoting the directory itself and the directory's parent directory are not included in the result.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order. An array of file resources denoting the files anddirectories in the directory denoted by this file resource.The array will be empty if the directory is empty. Returns null if this abstract pathname does not denotea directory, or if an I/O error occurs.




mkdir
boolean mkdir()(Code)
Creates the directory named by this file resource. true if and only if the directory wascreated; false otherwise



mkdirs
boolean mkdirs()(Code)
Creates the directory named by this file resource, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories. true if and only if the directory was created,along with all necessary parent directories; falseotherwise



toURI
URI toURI()(Code)
Returns a normalized version of the URI which was used in order to create this FileResource URI representing this object



toURL
URL toURL() throws MalformedURLException(Code)
Returns an URL which can be used in order to access the file donoted by this object. URL suitable to access the resource denoted by this object
throws:
  MalformedURLException - if this object does not contain a valid path



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.