Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.vfs
Interface FileSystem

All Known Implementing Classes:
  AbstractFileSystem, CompressedFileFileSystem, HttpFileSystem, LocalFileSystem, SftpFileSystem, TarFileSystem, UrlFileSystem, ZipFileSystem

public interface FileSystem

A file system, made up of a hierarchy of files.

Version:
  $Revision: 484648 $ $Date: 2006-12-08 17:18:36 +0100 (Fr, 08 Dez 2006) $
Author:
  Adam Murdoch

Method Summary
`void` | `addJunction(String junctionPoint, FileObject targetFile)` Adds a junction to this file system.
`void` | `addListener(FileObject file, FileListener listener)` Adds a listener on a file in this file system.
`Object` | `getAttribute(String attrName)` Gets the value of an attribute of the file system.
`FileSystemManager` | `getFileSystemManager()` Returns a reference to the FileSytemManager
`FileSystemOptions` | `getFileSystemOptions()` Returns the FileSystemOptions used to instantiate this filesystem
`double` | `getLastModTimeAccuracy()` Returns the accuracy of the last modification time
`FileObject` | `getParentLayer()` Returns the parent layer if this is a layered file system.
`FileObject` | `getRoot()` Returns the root file of this file system.
`FileName` | `getRootName()` Returns the name of the root file of this file system.
`boolean` | `hasCapability(Capability capability)` Determines if this file system has a particular capability.
`void` | `removeJunction(String junctionPoint)` Removes a junction from this file system.
`void` | `removeListener(FileObject file, FileListener listener)` Removes a listener from a file in this file system.
`File` | `replicateFile(FileObject file, FileSelector selector)` Creates a temporary local copy of a file and its descendents.
`FileObject` | `resolveFile(FileName name)` Finds a file in this file system.
`FileObject` | `resolveFile(String name)` Finds a file in this file system.
`void` | `setAttribute(String attrName, Object value)` Sets the value of an attribute of the file's content.

Method Detail

### getRoot

    public FileObject getRoot()
                       throws FileSystemException

  Returns the root file of this file system.

  Throws:
    `FileSystemException`

### getRootName

    public FileName getRootName()

  Returns the name of the root file of this file system.

### hasCapability

    public boolean hasCapability(Capability capability)

  Determines if this file system has a particular capability.

  Parameters:
    `capability` - The capability to check for.
  Returns:
    true if this filesystem has the requested capability. Note that not all files in the file system may have the capability.

### getParentLayer

    public FileObject getParentLayer()
                              throws FileSystemException

  Returns the parent layer if this is a layered file system.

  Returns:
    The parent layer, or null if this is not a layered file system.
  Throws:
    `FileSystemException`

### getAttribute

    public Object getAttribute(String attrName)
                        throws FileSystemException

  Gets the value of an attribute of the file system.

  TODO - change to `Map getAttributes()` instead?

  TODO - define the standard attribute names, and define which attrs are guaranteed to be present.

  Parameters:
    `attrName` - The name of the attribute.
  Returns:
    The value of the attribute.
  Throws:
    `FileSystemException` - If the file does not exist, or is being written, or if the attribute is unknown.
  See Also:
    `FileContent.getAttribute(java.lang.String)`

### setAttribute

    public void setAttribute(String attrName,
                             Object value)
                      throws FileSystemException

  Sets the value of an attribute of the file's content. Creates the file if it does not exist.

  Parameters:
    `attrName` - The name of the attribute.
    `value` - The value of the attribute.
  Throws:
    `FileSystemException` - If the file is read-only, or is being read, or if the attribute is not supported, or on error setting the attribute.
  See Also:
    `FileContent.setAttribute(java.lang.String, java.lang.Object)`

### resolveFile

    public FileObject resolveFile(FileName name)
                           throws FileSystemException

  Finds a file in this file system.

  Parameters:
    `name` - The name of the file.
  Returns:
    The file. Never returns null.
  Throws:
    `FileSystemException`

### resolveFile

    public FileObject resolveFile(String name)
                           throws FileSystemException

  Finds a file in this file system.

  Parameters:
    `name` - The name of the file. This must be an absolute path.
  Returns:
    The file. Never returns null.
  Throws:
    `FileSystemException`

### addListener

    public void addListener(FileObject file,
                            FileListener listener)

  Adds a listener on a file in this file system.

  Parameters:
    `file` - The file to attach the listener to.
    `listener` - The listener to add.

### removeListener

    public void removeListener(FileObject file,
                               FileListener listener)

  Removes a listener from a file in this file system.

  Parameters:
    `file` - The file to remove the listener from.
    `listener` - The listener to remove.

### addJunction

    public void addJunction(String junctionPoint,
                            FileObject targetFile)
                     throws FileSystemException

  Adds a junction to this file system. A junction is a link that attaches the supplied file to a point in this file system, making it look like part of the file system.

  Parameters:
    `junctionPoint` - The point in this file system to add the junction.
    `targetFile` - The file to link to.
  Throws:
    `FileSystemException` - If this file system does not support junctions, or the junction point or target file is invalid (the file system may not support nested junctions, for example).

### removeJunction

    public void removeJunction(String junctionPoint)
                        throws FileSystemException

  Removes a junction from this file system.

  Parameters:
    `junctionPoint` - The junction to remove.
  Throws:
    `FileSystemException` - On error removing the junction.

### replicateFile

    public File replicateFile(FileObject file,
                              FileSelector selector)
                       throws FileSystemException

  Creates a temporary local copy of a file and its descendents. If this file is already a local file, a copy is not made.

  Note that the local copy may include additonal files, that were not selected by the given selector.

  Parameters:
    `file` - The file to replicate.
    `selector` - The selector to use to select the files to replicate.
  Returns:
    The local copy of this file.
  Throws:
    `FileSystemException` - If this file does not exist, or on error replicating the file.

### getFileSystemOptions

    public FileSystemOptions getFileSystemOptions()

  Returns the FileSystemOptions used to instantiate this filesystem

### getFileSystemManager

    public FileSystemManager getFileSystemManager()

  Returns a reference to the FileSytemManager

### getLastModTimeAccuracy

    public double getLastModTimeAccuracy()

  Returns the accuracy of the last modification time

  Returns:
    ms 0 perfectly accurate, >0 might be off by this value e.g. sftp 1000ms

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 The Apache Software Foundation. All Rights Reserved.