Java Doc for FileObject.java in  » Library » Apache-commons-vfs-20070724-src » org » apache » commons » vfs » 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 » Library » Apache commons vfs 20070724 src » org.apache.commons.vfs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.vfs.FileObject

All known Subclasses:   org.apache.commons.vfs.provider.zip.ZipFileObject,  org.apache.commons.vfs.provider.AbstractFileObject,  org.apache.commons.vfs.impl.DecoratedFileObject,  org.apache.commons.vfs.provider.local.LocalFile,  org.apache.commons.vfs.provider.sftp.SftpFileObject,  org.apache.commons.vfs.provider.compressed.CompressedFileFileObject,  org.apache.commons.vfs.provider.url.UrlFileObject,  org.apache.commons.vfs.provider.ram.RamFileObject,  org.apache.commons.vfs.provider.tar.TarFileObject,
FileObject
public interface FileObject (Code)
Represents a file, and is used to access the content and structure of the file.

Files are arranged in a hierarchy. Each hierachy forms a file system. A file system represents things like a local OS file system, a windows share, an HTTP server, or the contents of a Zip file.

There are two types of files: Folders, which contain other files, and normal files, which contain data, or content. A folder may not have any content, and a normal file cannot contain other files.

File Naming

TODO - write this.

Reading and Writing a File

Reading and writing a file, and all other operations on the file's content, is done using the FileContent object returned by FileObject.getContent .

Creating and Deleting a File

A file is created using either FileObject.createFolder , FileObject.createFile , or by writing to the file using one of the FileContent methods.

A file is deleted using FileObject.delete . Recursive deletion can be done using FileObject.delete(FileSelector) .

Finding Files

Other files in the same file system as this file can be found using:

To find files in another file system, use a FileSystemManager .
author:
   Adam Murdoch
version:
   $Revision: 483899 $ $Date: 2006-12-08 01:47:09 -0800 (Fri, 08 Dec 2006) $
See Also:   FileSystemManager
See Also:   FileContent
See Also:   FileName





Method Summary
public  booleancanRenameTo(FileObject newfile)
     Queries the file if it is possible to rename it to newfile.
public  voidclose()
     Closes this file, and its content.
public  voidcopyFrom(FileObject srcFile, FileSelector selector)
     Copies another file, and all its descendents, to this file.

If this file does not exist, it is created.

public  voidcreateFile()
     Creates this file, if it does not exist.
public  voidcreateFolder()
     Creates this folder, if it does not exist.
public  booleandelete()
     Deletes this file.
public  intdelete(FileSelector selector)
     Deletes all descendents of this file that match a selector.
public  booleanexists()
     Determines if this file exists.
public  FileObject[]findFiles(FileSelector selector)
     Finds the set of matching descendents of this file, in depthwise order.
Parameters:
  selector - The selector to use to select matching files.
public  voidfindFiles(FileSelector selector, boolean depthwise, List selected)
     Finds the set of matching descendents of this file.
Parameters:
  selector - the selector used to determine if the file should be selected
Parameters:
  depthwise - controls the ordering in the list.
public  FileObjectgetChild(String name)
     Returns a child of this file.
public  FileObject[]getChildren()
     Lists the children of this file. An array containing the children of this file.
public  FileContentgetContent()
     Returns this file's content.
 FileOperationsgetFileOperations()
    
public  FileSystemgetFileSystem()
     Returns the file system that contains this file.
public  FileNamegetName()
     Returns the name of this file.
public  FileObjectgetParent()
     Returns the folder that contains this file. The folder that contains this file.
public  FileTypegetType()
     Returns this file's type. One of the FileType constants.
public  URLgetURL()
     Returns a URL representing this file.
public  booleanisAttached()
    
public  booleanisContentOpen()
    
public  booleanisHidden()
     Determines if this file is hidden.
public  booleanisReadable()
     Determines if this file can be read.
public  booleanisWriteable()
     Determines if this file can be written to.
public  voidmoveTo(FileObject destFile)
     Move this file.
public  voidrefresh()
    
public  FileObjectresolveFile(String name, NameScope scope)
     Finds a file, relative to this file.
public  FileObjectresolveFile(String path)
     Finds a file, relative to this file.



Method Detail
canRenameTo
public boolean canRenameTo(FileObject newfile)(Code)
Queries the file if it is possible to rename it to newfile.
Parameters:
  newfile - the new file(-name) true it this is the case



close
public void close() throws FileSystemException(Code)
Closes this file, and its content. This method is a hint to the implementation that it can release any resources associated with the file.

The file object can continue to be used after this method is called.
throws:
  FileSystemException - On error closing the file.
See Also:   FileContent.close




copyFrom
public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException(Code)
Copies another file, and all its descendents, to this file.

If this file does not exist, it is created. Its parent folder is also created, if necessary. If this file does exist, it is deleted first.

This method is not transactional. If it fails and throws an exception, this file will potentially only be partially copied.
Parameters:
  srcFile - The source file to copy.
Parameters:
  selector - The selector to use to select which files to copy.
throws:
  FileSystemException - If this file is read-only, or if the source file does not exist,or on error copying the file.




createFile
public void createFile() throws FileSystemException(Code)
Creates this file, if it does not exist. Also creates any ancestor folders which do not exist. This method does nothing if the file already exists and is a file.
throws:
  FileSystemException - If the file already exists with the wrong type, or the parentfolder is read-only, or on error creating this file or one ofits ancestors.



createFolder
public void createFolder() throws FileSystemException(Code)
Creates this folder, if it does not exist. Also creates any ancestor folders which do not exist. This method does nothing if the folder already exists.
throws:
  FileSystemException - If the folder already exists with the wrong type, or the parentfolder is read-only, or on error creating this folder or one ofits ancestors.



delete
public boolean delete() throws FileSystemException(Code)
Deletes this file. Does nothing if this file does not exist of if it is a folder that has children. Does not delete any descendents of this file, use FileObject.delete(FileSelector) for that. true if this object has been deleted
throws:
  FileSystemException - If this file is a non-empty folder, or if this file is read-only,or on error deleteing this file.



delete
public int delete(FileSelector selector) throws FileSystemException(Code)
Deletes all descendents of this file that match a selector. Does nothing if this file does not exist.

This method is not transactional. If it fails and throws an exception, this file will potentially only be partially deleted.
Parameters:
  selector - The selector to use to select which files to delete. the number of deleted objects
throws:
  FileSystemException - If this file or one of its descendents is read-only, or on errordeleting this file or one of its descendents.




exists
public boolean exists() throws FileSystemException(Code)
Determines if this file exists. true if this file exists, false if not.
throws:
  FileSystemException - On error determining if this file exists.



findFiles
public FileObject[] findFiles(FileSelector selector) throws FileSystemException(Code)
Finds the set of matching descendents of this file, in depthwise order.
Parameters:
  selector - The selector to use to select matching files. The matching files. The files are returned in depthwise order(that is, a child appears in the list before its parent).



findFiles
public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException(Code)
Finds the set of matching descendents of this file.
Parameters:
  selector - the selector used to determine if the file should be selected
Parameters:
  depthwise - controls the ordering in the list. e.g. deepest first
Parameters:
  selected - container for selected files. list needs not to be empty.
throws:
  FileSystemException -



getChild
public FileObject getChild(String name) throws FileSystemException(Code)
Returns a child of this file. Note that this method returns null when the child does not exist. This differs from FileObject.resolveFile(String,NameScope) which never returns null.
Parameters:
  name - The name of the child. The child, or null if there is no such child.
throws:
  FileSystemException - If this file does not exist, or is not a folder, or on errordetermining this file's children.



getChildren
public FileObject[] getChildren() throws FileSystemException(Code)
Lists the children of this file. An array containing the children of this file. The array isunordered. If the file does not have any children, a zero-lengtharray is returned. This method never returns null.
throws:
  FileSystemException - If this file does not exist, or is not a folder, or on errorlisting this file's children.



getContent
public FileContent getContent() throws FileSystemException(Code)
Returns this file's content. The FileContent returned by this method can be used to read and write the content of the file.

This method can be called if the file does not exist, and the returned FileContent can be used to create the file by writing its content. This file's content.
throws:
  FileSystemException - On error getting this file's content.




getFileOperations
FileOperations getFileOperations() throws FileSystemException(Code)
FileOperations interface that provides access to the operations API.
throws:
  FileSystemException -



getFileSystem
public FileSystem getFileSystem()(Code)
Returns the file system that contains this file. The file system.



getName
public FileName getName()(Code)
Returns the name of this file.



getParent
public FileObject getParent() throws FileSystemException(Code)
Returns the folder that contains this file. The folder that contains this file. Returns null if this file isthe root of a file system.
throws:
  FileSystemException - On error finding the file's parent.



getType
public FileType getType() throws FileSystemException(Code)
Returns this file's type. One of the FileType constants. Never returns null.
throws:
  FileSystemException - On error determining the file's type.



getURL
public URL getURL() throws FileSystemException(Code)
Returns a URL representing this file.



isAttached
public boolean isAttached()(Code)
check if the fileObject is attaced



isContentOpen
public boolean isContentOpen()(Code)
check if someone reads/write to this file



isHidden
public boolean isHidden() throws FileSystemException(Code)
Determines if this file is hidden. true if this file is hidden, false if not.
throws:
  FileSystemException - On error determining if this file exists.



isReadable
public boolean isReadable() throws FileSystemException(Code)
Determines if this file can be read. true if this file is readable, false if not.
throws:
  FileSystemException - On error determining if this file exists.



isWriteable
public boolean isWriteable() throws FileSystemException(Code)
Determines if this file can be written to. true if this file is writeable, false if not.
throws:
  FileSystemException - On error determining if this file exists.



moveTo
public void moveTo(FileObject destFile) throws FileSystemException(Code)
Move this file.

If the destFile exists, it is deleted first
Parameters:
  destFile - the New filename.
throws:
  FileSystemException - If this file is read-only, or if the source file does not exist,or on error copying the file.




refresh
public void refresh() throws FileSystemException(Code)
This will prepare the fileObject to get resynchronized with the underlaying filesystem if required



resolveFile
public FileObject resolveFile(String name, NameScope scope) throws FileSystemException(Code)
Finds a file, relative to this file. Refer to NameScope for a description of how names are resolved in the different scopes.
Parameters:
  name - The name to resolve. The file.
throws:
  FileSystemException - On error parsing the path, or on error finding the file.



resolveFile
public FileObject resolveFile(String path) throws FileSystemException(Code)
Finds a file, relative to this file. Equivalent to calling resolveFile( path, NameScope.FILE_SYSTEM ).
Parameters:
  path - The path of the file to locate. Can either be a relativepath or an absolute path. The file.
throws:
  FileSystemException - On error parsing the path, or on error finding the file.



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