public class LocalFileSystem extends AbstractFileSystem
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.
Modifier and Type | Class and Description |
---|---|
static class |
LocalFileSystem.Impl
The implementation class that implements List, Info
and Change interfaces and delegates all the methods
to appropriate methods of LocalFileSystem.
|
AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List, AbstractFileSystem.SymlinkInfo, AbstractFileSystem.Transfer
FileSystem.AtomicAction
attr, change, info, list, transfer
PROP_DISPLAY_NAME, PROP_HIDDEN, PROP_READ_ONLY, PROP_ROOT, PROP_SYSTEM_NAME, PROP_VALID
Constructor and Description |
---|
LocalFileSystem()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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) |
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) |
canRead, canWrite, checkVirtual, createReference, existingFileObjects, findReference, findResource, getRefreshTime, getRoot, markImportant, refresh, refreshResource, refreshRoot, setRefreshTime
addFileChangeListener, addFileStatusListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, createTempFile, find, findExtrasFor, fireFileStatusChanged, firePropertyChange, fireVetoableChange, getDecorator, getSystemName, getTempFolder, isDefault, isValid, removeFileChangeListener, removeFileStatusListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, runAtomicAction, setSystemName, toString
public String getDisplayName()
FileSystem
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
LocalFileSystem.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)
.
getDisplayName
in class AbstractFileSystem
public void setRootDirectory(File r) throws PropertyVetoException, IOException
r
- file to set root toPropertyVetoException
- if the value if vetoed by someone else (usually
by the Repository
)IOException
- if the root does not exists or some other error occuredpublic File getRootDirectory()
public void setReadOnly(boolean flag)
flag
- true
if it shouldpublic boolean isReadOnly()
FileSystem
isReadOnly
in class FileSystem
protected String computeSystemName(File rootFile)
The default implementation simply returns the filename separated by slashes.
rootFile
- root directory for the filesystemFileSystem.setSystemName(java.lang.String)
protected void createFolder(String name) throws IOException
IOException
protected void createData(String name) throws IOException
IOException
protected void rename(String oldName, String newName) throws IOException
IOException
protected void delete(String name) throws IOException
IOException
protected boolean folder(String name)
protected boolean readOnly(String name)
protected long size(String name)
protected InputStream inputStream(String name) throws FileNotFoundException
FileNotFoundException
protected OutputStream outputStream(String name) throws IOException
IOException
protected void lock(String name) throws IOException
IOException
protected void unlock(String name)
protected void markUnimportant(String name)