站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

LocalFileSystem (NetBeans APIs) - NetBeans API Javadoc 4.1.0


org.openide.filesystems
Class LocalFileSystem

java.lang.Object
  extended byorg.openide.filesystems.FileSystem
      extended byorg.openide.filesystems.AbstractFileSystem
          extended byorg.openide.filesystems.LocalFileSystem
All Implemented Interfaces:
Serializable

public class LocalFileSystem
extends AbstractFileSystem

Local filesystem. Provides access to files on local disk.

For historical reasons many AbstractFileSystem.* methods are implemented as protected in this class. Do not call them! Subclasses might override them, or (better) use delegation.

See Also:
Serialized Form

Nested 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.
 
Nested classes inherited from class org.openide.filesystems.AbstractFileSystem
AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List, AbstractFileSystem.Transfer
 
Nested classes inherited from class org.openide.filesystems.FileSystem
FileSystem.AtomicAction, FileSystem.Environment, FileSystem.HtmlStatus, FileSystem.Status
 
Field Summary
 
Fields inherited from class org.openide.filesystems.AbstractFileSystem
attr, change, info, list, transfer
 
Fields inherited from class org.openide.filesystems.FileSystem
PROP_DISPLAY_NAME, PROP_HIDDEN, PROP_READ_ONLY, PROP_ROOT, PROP_SYSTEM_NAME, PROP_VALID
 
Constructor Summary
LocalFileSystem()
          Constructor.
LocalFileSystem(FileSystemCapability cap)
          Deprecated. Useless.
 
Method Summary
protected  String[] children(String name)
           
protected  String computeSystemName(File rootFile)
          Compute the system name of this filesystem 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 filesystem.
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)
          Deprecated. Useless.
protected  boolean readOnly(String name)
           
protected  void rename(String oldName, String newName)
           
 void setReadOnly(boolean flag)
          Set whether the filesystem should be read only.
 void setRootDirectory(File r)
          Set the root directory of the filesystem.
protected  long size(String name)
           
protected  void unlock(String name)
           
 
Methods inherited from class org.openide.filesystems.AbstractFileSystem
canRead, canWrite, checkVirtual, createReference, existingFileObjects, find, findReference, findResource, getActions, getRefreshTime, getRoot, markImportant, refresh, refreshResource, refreshRoot, setRefreshTime
 
Methods inherited from class org.openide.filesystems.FileSystem
addFileChangeListener, addFileStatusListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, fireFileStatusChanged, firePropertyChange, fireVetoableChange, getActions, getCapability, getStatus, getSystemName, isDefault, isHidden, isPersistent, isValid, removeFileChangeListener, 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)
Deprecated. Useless.

Constructor. Allows user to provide own capabilities for this filesystem.

Parameters:
cap - capabilities for this filesystem
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.

Note: for most purposes it is probably a bad idea to use this method. Instead look at FileUtil.getFileDisplayName(org.openide.filesystems.FileObject).

Specified by:
getDisplayName in class AbstractFileSystem

setRootDirectory

public void setRootDirectory(File r)
                      throws PropertyVetoException,
                             IOException
Set the root directory of the filesystem.

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 filesystem.

Returns:
root directory

setReadOnly

public void setReadOnly(boolean flag)
Set whether the filesystem 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.

Specified by:
isReadOnly in class FileSystem
Returns:
true if the system is read-only

prepareEnvironment

public void prepareEnvironment(FileSystem.Environment environment)
Deprecated. Useless.

Prepare environment by adding the root directory of the filesystem 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 filesystem 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
Throws:
IOException

createData

protected void createData(String name)
                   throws IOException
Throws:
IOException

rename

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

delete

protected void delete(String name)
               throws IOException
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
Throws:
FileNotFoundException

outputStream

protected OutputStream outputStream(String name)
                             throws IOException
Throws:
IOException

lock

protected void lock(String name)
             throws IOException
Throws:
IOException

unlock

protected void unlock(String name)

markUnimportant

protected void markUnimportant(String name)


Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.