org.openide.filesystems
Class LocalFileSystem

java.lang.Object
  |
  +--org.openide.filesystems.FileSystem
        |
        +--org.openide.filesystems.AbstractFileSystem
              |
              +--org.openide.filesystems.LocalFileSystem
All Implemented Interfaces:
Serializable

public class LocalFileSystem
extends AbstractFileSystem

Local file system. Provides access to files on local disk.

See Also:
Serialized Form

Inner Class Summary
static class LocalFileSystem.Impl
          The implementation class that implements List, Info and Change interfaces and delegates all the methods to appropriate methods of LocalFileSystem.
 
Inner classes inherited from class org.openide.filesystems.AbstractFileSystem
AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List, AbstractFileSystem.Transfer
 
Inner classes inherited from class org.openide.filesystems.FileSystem
FileSystem.AtomicAction, FileSystem.Environment, FileSystem.Status
 
Fields inherited from class org.openide.filesystems.AbstractFileSystem
attr, change, info, list, transfer
 
Fields inherited from class org.openide.filesystems.FileSystem
PROP_HIDDEN, PROP_READ_ONLY, PROP_ROOT, PROP_SYSTEM_NAME, PROP_VALID
 
Constructor Summary
LocalFileSystem()
          Constructor.
LocalFileSystem(FileSystemCapability cap)
          Constructor.
 
Method Summary
protected  String[] children(String name)
           
protected  String computeSystemName(File rootFile)
          Compute the system name of this file system for a given root directory.
protected  void createData(String name)
           
protected  void createFolder(String name)
           
protected  void delete(String name)
           
protected  boolean folder(String name)
           
 String getDisplayName()
          Provides a name for the system that can be presented to the user.
 File getRootDirectory()
          Get the root directory of the file system.
protected  InputStream inputStream(String name)
           
 boolean isReadOnly()
          Test if the filesystem is read-only or not.
protected  Date lastModified(String name)
           
protected  void lock(String name)
           
protected  void markUnimportant(String name)
           
protected  String mimeType(String name)
           
protected  OutputStream outputStream(String name)
           
 void prepareEnvironment(FileSystem.Environment environment)
          Prepare environment by adding the root directory of the file system to the class path.
protected  boolean readOnly(String name)
           
protected  void rename(String oldName, String newName)
           
 void setReadOnly(boolean flag)
          Set whether the file system should be read only.
 void setRootDirectory(File r)
          Set the root directory of the file system.
protected  long size(String name)
           
protected  void unlock(String name)
           
 
Methods inherited from class org.openide.filesystems.AbstractFileSystem
checkVirtual, createReference, existingFileObjects, find, findReference, findResource, getActions, getRefreshTime, getRoot, markImportant, refreshResource, refreshRoot, setRefreshTime
 
Methods inherited from class org.openide.filesystems.FileSystem
addFileStatusListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, fireFileStatusChanged, firePropertyChange, fireVetoableChange, getActions, getCapability, getStatus, getSystemName, isDefault, isHidden, isPersistent, isValid, removeFileStatusListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, runAtomicAction, setCapability, setHidden, setSystemName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalFileSystem

public LocalFileSystem()
Constructor.

LocalFileSystem

public LocalFileSystem(FileSystemCapability cap)
Constructor. Allows user to provide own capabilities for this file system.
Parameters:
cap - capabilities for this file system
Method Detail

getDisplayName

public String getDisplayName()
Description copied from class: FileSystem
Provides a name for the system that can be presented to the user.

This call should never be used to attempt to identify the file root of the filesystem. On some systems it may happen to look the same but this is a coincidence and may well change in the future. Either check whether you are working with a LocalFileSystem or similar implementation and use getRootDirectory(); or better, try FileUtil.toFile(org.openide.filesystems.FileObject) which is designed to do this correctly.

Overrides:
getDisplayName in class AbstractFileSystem
Following copied from class: org.openide.filesystems.FileSystem
Returns:
user presentable name of the file system

setRootDirectory

public void setRootDirectory(File r)
                      throws PropertyVetoException,
                             IOException
Set the root directory of the file system.
Parameters:
r - file to set root to
Throws:
PropertyVetoException - if the value if vetoed by someone else (usually by the Repository)
IOException - if the root does not exists or some other error occured

getRootDirectory

public File getRootDirectory()
Get the root directory of the file system.
Returns:
root directory

setReadOnly

public void setReadOnly(boolean flag)
Set whether the file system should be read only.
Parameters:
flag - true if it should

isReadOnly

public boolean isReadOnly()
Description copied from class: FileSystem
Test if the filesystem is read-only or not.
Overrides:
isReadOnly in class FileSystem
Following copied from class: org.openide.filesystems.FileSystem
Returns:
true if the system is read-only

prepareEnvironment

public void prepareEnvironment(FileSystem.Environment environment)
Prepare environment by adding the root directory of the file system to the class path.
Overrides:
prepareEnvironment in class FileSystem
Parameters:
environment - the environment to add to

computeSystemName

protected String computeSystemName(File rootFile)
Compute the system name of this file system for a given root directory.

The default implementation simply returns the filename separated by slashes.

Parameters:
rootFile - root directory for the filesystem
Returns:
system name for the filesystem
See Also:
FileSystem.setSystemName(java.lang.String)

children

protected String[] children(String name)

createFolder

protected void createFolder(String name)
                     throws IOException

createData

protected void createData(String name)
                   throws IOException

rename

protected void rename(String oldName,
                      String newName)
               throws IOException

delete

protected void delete(String name)
               throws IOException

lastModified

protected Date lastModified(String name)

folder

protected boolean folder(String name)

readOnly

protected boolean readOnly(String name)

mimeType

protected String mimeType(String name)

size

protected long size(String name)

inputStream

protected InputStream inputStream(String name)
                           throws FileNotFoundException

outputStream

protected OutputStream outputStream(String name)
                             throws IOException

lock

protected void lock(String name)
             throws IOException

unlock

protected void unlock(String name)

markUnimportant

protected void markUnimportant(String name)


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.