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


java.lang.Object
   org.apache.commons.vfs.provider.AbstractFileObject

All known Subclasses:   org.apache.commons.vfs.provider.zip.ZipFileObject,  org.apache.commons.vfs.provider.ftp.FtpFileObject,  org.apache.commons.vfs.provider.http.HttpFileObject,  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.DelegateFileObject,  org.apache.commons.vfs.provider.tar.TarFileObject,
AbstractFileObject
abstract public class AbstractFileObject implements FileObject(Code)
A partial file object implementation.
author:
   Adam Murdoch
author:
   Gary D. Gregory
version:
   $Revision: 537944 $ $Date: 2007-05-14 11:41:51 -0700 (Mon, 14 May 2007) $



Constructor Summary
protected  AbstractFileObject(FileName name, AbstractFileSystem fs)
    

Method Summary
public  booleancanRenameTo(FileObject newfile)
     Queries the object if a simple rename to the filename of newfile is possible.
protected  voidchildrenChanged()
     Notifies the file that its children have changed.
protected  voidchildrenChanged(FileName childName, FileType newType)
     Notifies the file that its children have changed.
public  voidclose()
     Closes this file, and its content.
public  voidcopyFrom(FileObject file, FileSelector selector)
     Copies another file to this file.
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 this file, and all children.
protected  voiddoAttach()
     Attaches this file object to its file resource.
protected  FileContentdoCreateFileContent()
    
protected  voiddoCreateFolder()
     Creates this file as a folder.
protected  voiddoDelete()
     Deletes the file.
protected  voiddoDetach()
     Detaches this file object from its file resource.

Called when this file is closed.

protected  MapdoGetAttributes()
     Returns the attributes of this file.
protected  Certificate[]doGetCertificates()
     Returns the certificates used to sign this file.
abstract protected  longdoGetContentSize()
     Returns the size of the file content (in bytes).
abstract protected  InputStreamdoGetInputStream()
     Creates an input stream to read the file content from.
protected  longdoGetLastModifiedTime()
     Returns the last modified time of this file.
protected  OutputStreamdoGetOutputStream(boolean bAppend)
     Creates an output stream to write the file content to.
protected  RandomAccessContentdoGetRandomAccessContent(RandomAccessMode mode)
     Creates access to the file for random i/o.
abstract protected  FileTypedoGetType()
     Determines the type of this file.
protected  booleandoIsHidden()
     Determines if this file is hidden.
protected  booleandoIsReadable()
     Determines if this file can be read.
protected  booleandoIsSameFile(FileObject destFile)
     Checks if this fileObject is the same file as destFile just with a different name.
E.g.
protected  booleandoIsWriteable()
     Determines if this file can be written to.
abstract protected  String[]doListChildren()
     Lists the children of this file.
protected  FileObject[]doListChildrenResolved()
     Lists the children of this file.
protected  voiddoRemoveAttribute(String atttrName)
     Removes an attribute of this file.
protected  voiddoRename(FileObject newfile)
     Renames the file.
protected  voiddoSetAttribute(String atttrName, Object value)
     Sets an attribute of this file.
protected  booleandoSetLastModTime(long modtime)
     Sets the last modified time of this file.
protected  voiddoSetLastModifiedTime(long modtime)
     Sets the last modified time of this file.
protected  voidendOutput()
     Called when the ouput stream for this file is closed.
public  booleanexists()
     Determines if the file exists.
protected  voidfinalize()
    
public  FileObject[]findFiles(FileSelector selector)
     Finds the set of matching descendents of this file, in depthwise order.
public  voidfindFiles(FileSelector selector, boolean depthwise, List selected)
     Traverses the descendents of this file, and builds a list of selected files.
public  FileObjectgetChild(String name)
     Returns a child of this file.
public  FileObject[]getChildren()
     Returns the children of the file.
public  FileContentgetContent()
     Returns the file's content.
protected  FileContentInfoFactorygetFileContentInfoFactory()
    
public  FileOperationsgetFileOperations()
    
public  FileSystemgetFileSystem()
     Returns the file system this file belongs to.
public  InputStreamgetInputStream()
     Returns an input stream to use to read the content of the file.
public  FileNamegetName()
     Returns the name of the file.
public  OutputStreamgetOutputStream()
     Prepares this file for writing.
public  OutputStreamgetOutputStream(boolean bAppend)
     Prepares this file for writing.
public  FileObjectgetParent()
     Returns the parent of the file.
public  RandomAccessContentgetRandomAccessContent(RandomAccessMode mode)
     Returns an input/output stream to use to read and write the content of the file in and random manner.
public  FileTypegetType()
     Returns the file's type.
public  URLgetURL()
     Returns a URL representation of the file.
protected  voidhandleChanged()
     Called when this file is changed.
This will only happen if you monitor the file using org.apache.commons.vfs.FileMonitor .
protected  voidhandleCreate(FileType newType)
     Called when this file is created.
protected  voidhandleDelete()
     Called when this file is deleted.
public  voidholdObject(Object strongRef)
     This method is meant to add a object where this object holds a strong reference then. E.g.
protected  voidinjectType(FileType fileType)
    
public  booleanisAttached()
    
public  booleanisContentOpen()
    
public  booleanisHidden()
     Determines if this file can be read.
public  booleanisReadable()
     Determines if this file can be read.
protected  booleanisSameFile(FileObject destFile)
     Checks if this fileObject is the same file as destFile just with a different name.
E.g.
public  booleanisWriteable()
     Determines if this file can be written to.
public  voidmoveTo(FileObject destFile)
    
protected  voidnotifyAllStreamsClosed()
     will be called after this file-object closed all its streams.
protected  voidonChange()
     Called when the type or content of this file changes.
protected  voidonChildrenChanged(FileName child, FileType newType)
     Called when the children of this file change.
public  voidrefresh()
    
public  FileObjectresolveFile(String name, NameScope scope)
     Returns a child by name.
public  FileObjectresolveFile(String path)
     Finds a file, relative to this file.
Parameters:
  path - The path of the file to locate.
public  StringtoString()
     Returns the URI of the file.


Constructor Detail
AbstractFileObject
protected AbstractFileObject(FileName name, AbstractFileSystem fs)(Code)




Method Detail
canRenameTo
public boolean canRenameTo(FileObject newfile)(Code)
Queries the object if a simple rename to the filename of newfile is possible.
Parameters:
  newfile - the new filename true if rename is possible



childrenChanged
protected void childrenChanged() throws Exception(Code)
Notifies the file that its children have changed. AbstractFileObject.childrenChanged(FileName,FileType)



childrenChanged
protected void childrenChanged(FileName childName, FileType newType) throws Exception(Code)
Notifies the file that its children have changed.



close
public void close() throws FileSystemException(Code)
Closes this file, and its content.



copyFrom
public void copyFrom(FileObject file, FileSelector selector) throws FileSystemException(Code)
Copies another file to this file.



createFile
public void createFile() throws FileSystemException(Code)
Creates this file, if it does not exist.



createFolder
public void createFolder() throws FileSystemException(Code)
Creates this folder, if it does not exist. Also creates any ancestor files which do not exist.



delete
public boolean delete() throws FileSystemException(Code)
Deletes this file. true if this object has been deleted



delete
public int delete(FileSelector selector) throws FileSystemException(Code)
Deletes this file, and all children. the number of deleted files



doAttach
protected void doAttach() throws Exception(Code)
Attaches this file object to its file resource. This method is called before any of the doBlah() or onBlah() methods. Sub-classes can use this method to perform lazy initialisation.

This implementation does nothing.




doCreateFileContent
protected FileContent doCreateFileContent() throws FileSystemException(Code)
Create a FileContent implementation



doCreateFolder
protected void doCreateFolder() throws Exception(Code)
Creates this file as a folder. Is only called when:

This implementation throws an exception.




doDelete
protected void doDelete() throws Exception(Code)
Deletes the file. Is only called when:

This implementation throws an exception.




doDetach
protected void doDetach() throws Exception(Code)
Detaches this file object from its file resource.

Called when this file is closed. Note that the file object may be reused later, so should be able to be reattached.

This implementation does nothing.




doGetAttributes
protected Map doGetAttributes() throws Exception(Code)
Returns the attributes of this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation always returns an empty map.




doGetCertificates
protected Certificate[] doGetCertificates() throws Exception(Code)
Returns the certificates used to sign this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation always returns null.




doGetContentSize
abstract protected long doGetContentSize() throws Exception(Code)
Returns the size of the file content (in bytes). Is only called if AbstractFileObject.doGetType returns FileType.FILE .



doGetInputStream
abstract protected InputStream doGetInputStream() throws Exception(Code)
Creates an input stream to read the file content from. Is only called if AbstractFileObject.doGetType returns FileType.FILE .

It is guaranteed that there are no open output streams for this file when this method is called.

The returned stream does not have to be buffered.




doGetLastModifiedTime
protected long doGetLastModifiedTime() throws Exception(Code)
Returns the last modified time of this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation throws an exception.




doGetOutputStream
protected OutputStream doGetOutputStream(boolean bAppend) throws Exception(Code)
Creates an output stream to write the file content to. Is only called if:

It is guaranteed that there are no open stream (input or output) for this file when this method is called.

The returned stream does not have to be buffered.

This implementation throws an exception.




doGetRandomAccessContent
protected RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode) throws Exception(Code)
Creates access to the file for random i/o. Is only called if AbstractFileObject.doGetType returns FileType.FILE .

It is guaranteed that there are no open output streams for this file when this method is called.




doGetType
abstract protected FileType doGetType() throws Exception(Code)
Determines the type of this file. Must not return null. The return value of this method is cached, so the implementation can be expensive.



doIsHidden
protected boolean doIsHidden() throws Exception(Code)
Determines if this file is hidden. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation always returns false.




doIsReadable
protected boolean doIsReadable() throws Exception(Code)
Determines if this file can be read. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation always returns true.




doIsSameFile
protected boolean doIsSameFile(FileObject destFile) throws FileSystemException(Code)
Checks if this fileObject is the same file as destFile just with a different name.
E.g. for case insensitive filesystems like windows.



doIsWriteable
protected boolean doIsWriteable() throws Exception(Code)
Determines if this file can be written to. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation always returns true.




doListChildren
abstract protected String[] doListChildren() throws Exception(Code)
Lists the children of this file. Is only called if AbstractFileObject.doGetType returns FileType.FOLDER . The return value of this method is cached, so the implementation can be expensive.



doListChildrenResolved
protected FileObject[] doListChildrenResolved() throws Exception(Code)
Lists the children of this file. Is only called if AbstractFileObject.doGetType returns FileType.FOLDER . The return value of this method is cached, so the implementation can be expensive.
Other than doListChildren you could return FileObject's to e.g. reinitialize the type of the file.
(Introduced for Webdav: "permission denied on resource" during getType())



doRemoveAttribute
protected void doRemoveAttribute(String atttrName) throws Exception(Code)
Removes an attribute of this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation throws an exception.




doRename
protected void doRename(FileObject newfile) throws Exception(Code)
Renames the file. Is only called when:

This implementation throws an exception.




doSetAttribute
protected void doSetAttribute(String atttrName, Object value) throws Exception(Code)
Sets an attribute of this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation throws an exception.




doSetLastModTime
protected boolean doSetLastModTime(long modtime) throws Exception(Code)
Sets the last modified time of this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation throws an exception. false if it was not possible to change the time




doSetLastModifiedTime
protected void doSetLastModifiedTime(long modtime) throws Exception(Code)
Sets the last modified time of this file. Is only called if AbstractFileObject.doGetType does not return FileType.IMAGINARY .

This implementation throws an exception. AbstractFileObject.doSetLastModTime




endOutput
protected void endOutput() throws Exception(Code)
Called when the ouput stream for this file is closed.



exists
public boolean exists() throws FileSystemException(Code)
Determines if the file exists.



finalize
protected void finalize() throws Throwable(Code)



findFiles
public FileObject[] findFiles(FileSelector selector) throws FileSystemException(Code)
Finds the set of matching descendents of this file, in depthwise order. list of files or null if the base file (this object) do not exist



findFiles
public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException(Code)
Traverses the descendents of this file, and builds a list of selected files.



getChild
public FileObject getChild(String name) throws FileSystemException(Code)
Returns a child of this file.



getChildren
public FileObject[] getChildren() throws FileSystemException(Code)
Returns the children of the file.



getContent
public FileContent getContent() throws FileSystemException(Code)
Returns the file's content.



getFileContentInfoFactory
protected FileContentInfoFactory getFileContentInfoFactory()(Code)
create the filecontentinfo implementation



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



getFileSystem
public FileSystem getFileSystem()(Code)
Returns the file system this file belongs to.



getInputStream
public InputStream getInputStream() throws FileSystemException(Code)
Returns an input stream to use to read the content of the file.



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



getOutputStream
public OutputStream getOutputStream() throws FileSystemException(Code)
Prepares this file for writing. Makes sure it is either a file, or its parent folder exists. Returns an output stream to use to write the content of the file to.



getOutputStream
public OutputStream getOutputStream(boolean bAppend) throws FileSystemException(Code)
Prepares this file for writing. Makes sure it is either a file, or its parent folder exists. Returns an output stream to use to write the content of the file to.

Parameters:
  bAppend - true when append to the file.
Note: If the underlaying filesystem do not support this, it wont work.



getParent
public FileObject getParent() throws FileSystemException(Code)
Returns the parent of the file.



getRandomAccessContent
public RandomAccessContent getRandomAccessContent(RandomAccessMode mode) throws FileSystemException(Code)
Returns an input/output stream to use to read and write the content of the file in and random manner.



getType
public FileType getType() throws FileSystemException(Code)
Returns the file's type.



getURL
public URL getURL() throws FileSystemException(Code)
Returns a URL representation of the file.



handleChanged
protected void handleChanged() throws Exception(Code)
Called when this file is changed.
This will only happen if you monitor the file using org.apache.commons.vfs.FileMonitor .



handleCreate
protected void handleCreate(FileType newType) throws Exception(Code)
Called when this file is created. Updates cached info and notifies the parent and file system.



handleDelete
protected void handleDelete() throws Exception(Code)
Called when this file is deleted. Updates cached info and notifies subclasses, parent and file system.



holdObject
public void holdObject(Object strongRef)(Code)
This method is meant to add a object where this object holds a strong reference then. E.g. a archive-filesystem creates a list of all childs and they shouldnt get garbage collected until the container is garbage collected
Parameters:
  strongRef -



injectType
protected void injectType(FileType fileType)(Code)



isAttached
public boolean isAttached()(Code)
Check if the internal state is "attached" true if this is the case



isContentOpen
public boolean isContentOpen()(Code)
Check if the content stream is open true if this is the case



isHidden
public boolean isHidden() throws FileSystemException(Code)
Determines if this file can be read.



isReadable
public boolean isReadable() throws FileSystemException(Code)
Determines if this file can be read.



isSameFile
protected boolean isSameFile(FileObject destFile) throws FileSystemException(Code)
Checks if this fileObject is the same file as destFile just with a different name.
E.g. for case insensitive filesystems like windows.



isWriteable
public boolean isWriteable() throws FileSystemException(Code)
Determines if this file can be written to.



moveTo
public void moveTo(FileObject destFile) throws FileSystemException(Code)
Moves (rename) the file to another one



notifyAllStreamsClosed
protected void notifyAllStreamsClosed()(Code)
will be called after this file-object closed all its streams.



onChange
protected void onChange() throws Exception(Code)
Called when the type or content of this file changes.

This implementation does nothing.




onChildrenChanged
protected void onChildrenChanged(FileName child, FileType newType) throws Exception(Code)
Called when the children of this file change. Allows subclasses to refresh any cached information about the children of this file.

This implementation does nothing.




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)
Returns a child by name.



resolveFile
public FileObject resolveFile(String path) throws FileSystemException(Code)
Finds a file, relative to this file.
Parameters:
  path - The path of the file to locate. Can either be a relativepath, which is resolved relative to this file, or anabsolute path, which is resolved relative to the file systemthat contains this file.



toString
public String toString()(Code)
Returns the URI of the file.



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.