org.gjt.sp.jedit.io
Class FileVFS

java.lang.Object
  extended byorg.gjt.sp.jedit.io.VFS
      extended byorg.gjt.sp.jedit.io.FileVFS

public class FileVFS
extends VFS

Local filesystem VFS.

Version:
$Id: FileVFS.java,v 1.47 2004/06/09 16:48:40 spestov Exp $
Author:
Slava Pestov

Nested Class Summary
static class FileVFS.LocalDirectoryEntry
           
 
Nested classes inherited from class org.gjt.sp.jedit.io.VFS
VFS.DirectoryEntry, VFS.DirectoryEntryCompare
 
Field Summary
static java.lang.String PERMISSIONS_PROPERTY
           
 
Fields inherited from class org.gjt.sp.jedit.io.VFS
BROWSE_CAP, CASE_INSENSITIVE_CAP, DELETE_CAP, EA_MODIFIED, EA_SIZE, EA_STATUS, EA_TYPE, LOW_LATENCY_CAP, MKDIR_CAP, READ_CAP, RENAME_CAP, WRITE_CAP
 
Constructor Summary
FileVFS()
           
 
Method Summary
 void _backup(java.lang.Object session, java.lang.String path, java.awt.Component comp)
          Backs up the specified file.
 java.lang.String _canonPath(java.lang.Object session, java.lang.String path, java.awt.Component comp)
          Returns the canonical form if the specified path name.
 java.io.InputStream _createInputStream(java.lang.Object session, java.lang.String path, boolean ignoreErrors, java.awt.Component comp)
          Creates an input stream.
 java.io.OutputStream _createOutputStream(java.lang.Object session, java.lang.String path, java.awt.Component comp)
          Creates an output stream.
 boolean _delete(java.lang.Object session, java.lang.String path, java.awt.Component comp)
          Deletes the specified URL.
 VFS.DirectoryEntry _getDirectoryEntry(java.lang.Object session, java.lang.String path, java.awt.Component comp)
          Returns the specified directory entry.
 VFS.DirectoryEntry[] _listDirectory(java.lang.Object session, java.lang.String path, java.awt.Component comp)
          Lists the specified directory.
 boolean _mkdir(java.lang.Object session, java.lang.String directory, java.awt.Component comp)
          Creates a new directory with the specified URL.
 boolean _rename(java.lang.Object session, java.lang.String from, java.lang.String to, java.awt.Component comp)
          Renames the specified URL.
 void _saveComplete(java.lang.Object session, Buffer buffer, java.lang.String path, java.awt.Component comp)
          Called after a file has been saved.
 java.lang.String constructPath(java.lang.String parent, java.lang.String path)
          Constructs a path from the specified directory and file name component.
 char getFileSeparator()
          Returns the file separator used by this VFS.
 java.lang.String getParentOfPath(java.lang.String path)
          Returns the parent of the specified path.
static int getPermissions(java.lang.String path)
          Returns numeric permissions of a file.
 boolean insert(View view, Buffer buffer, java.lang.String path)
          Inserts a file into the specified buffer.
 boolean save(View view, Buffer buffer, java.lang.String path)
          Saves the specifies buffer.
static void setPermissions(java.lang.String path, int permissions)
          Sets numeric permissions of a file.
 
Methods inherited from class org.gjt.sp.jedit.io.VFS
_endVFSSession, _listDirectory, createVFSSession, getCapabilities, getDefaultColorFor, getExtendedAttributes, getFileName, getName, getTwoStageSaveName, load, reloadDirectory, showBrowseDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERMISSIONS_PROPERTY

public static final java.lang.String PERMISSIONS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

FileVFS

public FileVFS()
Method Detail

getParentOfPath

public java.lang.String getParentOfPath(java.lang.String path)
Description copied from class: VFS
Returns the parent of the specified path. This must be overridden to return a non-null value for browsing of this filesystem to work.

Overrides:
getParentOfPath in class VFS
Parameters:
path - The path

constructPath

public java.lang.String constructPath(java.lang.String parent,
                                      java.lang.String path)
Description copied from class: VFS
Constructs a path from the specified directory and file name component. This must be overridden to return a non-null value, otherwise browsing this filesystem will not work.

Unless you are writing a VFS, this method should not be called directly. To ensure correct behavior, you must call MiscUtilities.constructPath(String,String) instead.

Overrides:
constructPath in class VFS
Parameters:
parent - The parent directory
path - The path

getFileSeparator

public char getFileSeparator()
Description copied from class: VFS
Returns the file separator used by this VFS.

Overrides:
getFileSeparator in class VFS

save

public boolean save(View view,
                    Buffer buffer,
                    java.lang.String path)
Description copied from class: VFS
Saves the specifies buffer. The default implementation posts an I/O request to the I/O thread.

Overrides:
save in class VFS
Parameters:
view - The view
buffer - The buffer
path - The path

insert

public boolean insert(View view,
                      Buffer buffer,
                      java.lang.String path)
Description copied from class: VFS
Inserts a file into the specified buffer. The default implementation posts an I/O request to the I/O thread.

Overrides:
insert in class VFS
Parameters:
view - The view
buffer - The buffer
path - The path

_canonPath

public java.lang.String _canonPath(java.lang.Object session,
                                   java.lang.String path,
                                   java.awt.Component comp)
                            throws java.io.IOException
Returns the canonical form if the specified path name. For example, ~ might be expanded to the user's home directory.

Overrides:
_canonPath in class VFS
Parameters:
session - The session
path - The path
comp - The component that will parent error dialog boxes
Throws:
java.io.IOException - if an I/O error occurred
Since:
jEdit 4.0pre2

_listDirectory

public VFS.DirectoryEntry[] _listDirectory(java.lang.Object session,
                                           java.lang.String path,
                                           java.awt.Component comp)
Description copied from class: VFS
Lists the specified directory.

Overrides:
_listDirectory in class VFS
Parameters:
session - The session
path - The directory. Note that this must be a full URL, including the host name, path name, and so on. The username and password (if needed by the VFS) is obtained from the session instance.
comp - The component that will parent error dialog boxes

_getDirectoryEntry

public VFS.DirectoryEntry _getDirectoryEntry(java.lang.Object session,
                                             java.lang.String path,
                                             java.awt.Component comp)
Description copied from class: VFS
Returns the specified directory entry.

Overrides:
_getDirectoryEntry in class VFS
Parameters:
session - The session
path - The path
comp - The component that will parent error dialog boxes
Returns:
The specified directory entry, or null if it doesn't exist.

_delete

public boolean _delete(java.lang.Object session,
                       java.lang.String path,
                       java.awt.Component comp)
Description copied from class: VFS
Deletes the specified URL.

Overrides:
_delete in class VFS
Parameters:
session - The VFS session
path - The path
comp - The component that will parent error dialog boxes

_rename

public boolean _rename(java.lang.Object session,
                       java.lang.String from,
                       java.lang.String to,
                       java.awt.Component comp)
Description copied from class: VFS
Renames the specified URL. Some filesystems might support moving URLs between directories, however others may not. Do not rely on this behavior.

Overrides:
_rename in class VFS
Parameters:
session - The VFS session
from - The old path
to - The new path
comp - The component that will parent error dialog boxes

_mkdir

public boolean _mkdir(java.lang.Object session,
                      java.lang.String directory,
                      java.awt.Component comp)
Description copied from class: VFS
Creates a new directory with the specified URL.

Overrides:
_mkdir in class VFS
Parameters:
session - The VFS session
directory - The directory
comp - The component that will parent error dialog boxes

_backup

public void _backup(java.lang.Object session,
                    java.lang.String path,
                    java.awt.Component comp)
             throws java.io.IOException
Description copied from class: VFS
Backs up the specified file. This should only be overriden by the local filesystem VFS.

Overrides:
_backup in class VFS
Parameters:
session - The VFS session
path - The path
comp - The component that will parent error dialog boxes
Throws:
java.io.IOException - if an I/O error occurs

_createInputStream

public java.io.InputStream _createInputStream(java.lang.Object session,
                                              java.lang.String path,
                                              boolean ignoreErrors,
                                              java.awt.Component comp)
                                       throws java.io.IOException
Description copied from class: VFS
Creates an input stream. This method is called from the I/O thread.

Overrides:
_createInputStream in class VFS
Parameters:
session - the VFS session
path - The path
ignoreErrors - If true, file not found errors should be ignored
comp - The component that will parent error dialog boxes
Throws:
java.io.IOException - If an I/O error occurs

_createOutputStream

public java.io.OutputStream _createOutputStream(java.lang.Object session,
                                                java.lang.String path,
                                                java.awt.Component comp)
                                         throws java.io.IOException
Description copied from class: VFS
Creates an output stream. This method is called from the I/O thread.

Overrides:
_createOutputStream in class VFS
Parameters:
session - the VFS session
path - The path
comp - The component that will parent error dialog boxes
Throws:
java.io.IOException - If an I/O error occurs

_saveComplete

public void _saveComplete(java.lang.Object session,
                          Buffer buffer,
                          java.lang.String path,
                          java.awt.Component comp)
Description copied from class: VFS
Called after a file has been saved.

Overrides:
_saveComplete in class VFS
Parameters:
session - The VFS session
buffer - The buffer
path - The path the buffer was saved to (can be different from Buffer.getPath() if the user invoked the Save a Copy As command, for example).
comp - The component that will parent error dialog boxes

getPermissions

public static int getPermissions(java.lang.String path)
Returns numeric permissions of a file. On non-Unix systems, always returns zero.

Since:
jEdit 3.2pre9

setPermissions

public static void setPermissions(java.lang.String path,
                                  int permissions)
Sets numeric permissions of a file. On non-Unix platforms, does nothing.

Since:
jEdit 3.2pre9