|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.sp.jedit.io.VFS
A virtual filesystem implementation.
Session objects:
A session is used to persist things like login information, any network sockets, etc. File system implementations that do not need this kind of persistence return a dummy object as a session.
Methods whose names are prefixed with "_" expect to be given a previously-obtained session object. A session must be obtained from the AWT thread in one of two ways:
When done, the session must be disposed of using_endVFSSession(Object,Component)
.Thread safety:
The following methods cannot be called from an I/O thread:
createVFSSession(String,Component)
insert(View,Buffer,String)
load(View,Buffer,String)
save(View,Buffer,String)
showBrowseDialog(Object[],Component)
VFSManager.registerVFS(String,VFS)
,
VFSManager.getVFSByName(String)
,
VFSManager.getVFSForPath(String)
,
VFSManager.getVFSForProtocol(String)
Nested Class Summary | |
static class |
VFS.DirectoryEntry
A directory entry. |
Field Summary | |
static int |
BROWSE_CAP
If set, a menu item for this VFS will appear in the browser's Plugins menu. |
static int |
DELETE_CAP
Delete file capability. |
static int |
LOW_LATENCY_CAP
Low latency capability. |
static int |
MKDIR_CAP
Make directory capability. |
static int |
READ_CAP
Read capability. |
static int |
RENAME_CAP
Rename file capability. |
static int |
WRITE_CAP
Write capability. |
Constructor Summary | |
VFS(java.lang.String name)
Creates a new virtual filesystem. |
|
VFS(java.lang.String name,
int caps)
Creates a new virtual filesystem. |
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 of 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. |
void |
_endVFSSession(java.lang.Object session,
java.awt.Component comp)
Finishes the specified VFS session. |
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 directory,
java.awt.Component comp)
Lists the specified directory. |
java.lang.String[] |
_listDirectory(java.lang.Object session,
java.lang.String directory,
java.lang.String glob,
boolean recursive,
java.awt.Component comp)
A convinience method that matches file names against globs, and can optionally list the directory recursively. |
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. |
java.lang.Object |
createVFSSession(java.lang.String path,
java.awt.Component comp)
Creates a VFS session. |
int |
getCapabilities()
Returns the capabilities of this VFS. |
static java.awt.Color |
getDefaultColorFor(java.lang.String name)
Returns color of the specified file name, by matching it against user-specified regular expressions. |
java.lang.String |
getFileName(java.lang.String path)
Returns the file name component of the specified path. |
char |
getFileSeparator()
Returns the file separator used by this VFS. |
java.lang.String |
getName()
Returns this VFS's name. |
java.lang.String |
getParentOfPath(java.lang.String path)
Returns the parent of the specified path. |
java.lang.String |
getTwoStageSaveName(java.lang.String path)
Returns a temporary file name based on the given path. |
boolean |
insert(View view,
Buffer buffer,
java.lang.String path)
Inserts a file into the specified buffer. |
boolean |
load(View view,
Buffer buffer,
java.lang.String path)
Loads the specified buffer. |
void |
reloadDirectory(java.lang.String path)
Called before a directory is reloaded by the file system browser. |
boolean |
save(View view,
Buffer buffer,
java.lang.String path)
Saves the specifies buffer. |
java.lang.String |
showBrowseDialog(java.lang.Object[] session,
java.awt.Component comp)
Displays a dialog box that should set up a session and return the initial URL to browse. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int READ_CAP
public static final int WRITE_CAP
public static final int BROWSE_CAP
vfs.name.label
is used as a menu item label.
When invoked, the menu item calls the
showBrowseDialog(Object[],Component)
method of the VFS,
and then lists the directory returned by that method.
If this capability is not set, it will still be possible to type in URLs for this VFS in the browser, but there won't be a user-visible way of doing this.
public static final int DELETE_CAP
public static final int RENAME_CAP
public static final int MKDIR_CAP
public static final int LOW_LATENCY_CAP
Constructor Detail |
public VFS(java.lang.String name)
name
- The namepublic VFS(java.lang.String name, int caps)
name
- The namecaps
- The capabilitiesMethod Detail |
public java.lang.String getName()
vfs.name.label
property.
public int getCapabilities()
public java.lang.String showBrowseDialog(java.lang.Object[] session, java.awt.Component comp)
session
- Where the VFS session will be storedcomp
- The component that will parent error dialog boxes
public java.lang.String getFileName(java.lang.String path)
path
- The pathpublic java.lang.String getParentOfPath(java.lang.String path)
path
- The pathpublic java.lang.String constructPath(java.lang.String parent, java.lang.String path)
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.
parent
- The parent directorypath
- The pathpublic char getFileSeparator()
public java.lang.String getTwoStageSaveName(java.lang.String path)
#name#save#
and then renames it to the original file. However some virtual file
systems might not support the #
character in filenames,
so this method permits the VFS to override this behavior.
path
- The path namepublic void reloadDirectory(java.lang.String path)
public java.lang.Object createVFSSession(java.lang.String path, java.awt.Component comp)
path
- The path in questioncomp
- The component that will parent any dialog boxes shown
public boolean load(View view, Buffer buffer, java.lang.String path)
view
- The viewbuffer
- The bufferpath
- The pathpublic boolean save(View view, Buffer buffer, java.lang.String path)
view
- The viewbuffer
- The bufferpath
- The pathpublic boolean insert(View view, Buffer buffer, java.lang.String path)
view
- The viewbuffer
- The bufferpath
- The pathpublic java.lang.String _canonPath(java.lang.Object session, java.lang.String path, java.awt.Component comp) throws java.io.IOException
~
might be expanded to the user's home directory.
session
- The sessionpath
- The pathcomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurredpublic java.lang.String[] _listDirectory(java.lang.Object session, java.lang.String directory, java.lang.String glob, boolean recursive, java.awt.Component comp) throws java.io.IOException
session
- The sessiondirectory
- 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.glob
- Only file names matching this glob will be returnedrecursive
- If true, subdirectories will also be listed.comp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurredpublic VFS.DirectoryEntry[] _listDirectory(java.lang.Object session, java.lang.String directory, java.awt.Component comp) throws java.io.IOException
session
- The sessiondirectory
- 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
java.io.IOException
- if an I/O error occurredpublic VFS.DirectoryEntry _getDirectoryEntry(java.lang.Object session, java.lang.String path, java.awt.Component comp) throws java.io.IOException
session
- The sessionpath
- The pathcomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurredpublic boolean _delete(java.lang.Object session, java.lang.String path, java.awt.Component comp) throws java.io.IOException
session
- The VFS sessionpath
- The pathcomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurspublic boolean _rename(java.lang.Object session, java.lang.String from, java.lang.String to, java.awt.Component comp) throws java.io.IOException
session
- The VFS sessionfrom
- The old pathto
- The new pathcomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurspublic boolean _mkdir(java.lang.Object session, java.lang.String directory, java.awt.Component comp) throws java.io.IOException
session
- The VFS sessiondirectory
- The directorycomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurspublic void _backup(java.lang.Object session, java.lang.String path, java.awt.Component comp) throws java.io.IOException
session
- The VFS sessionpath
- The pathcomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurspublic java.io.InputStream _createInputStream(java.lang.Object session, java.lang.String path, boolean ignoreErrors, java.awt.Component comp) throws java.io.IOException
session
- the VFS sessionpath
- The pathignoreErrors
- If true, file not found errors should be
ignoredcomp
- The component that will parent error dialog boxes
java.io.IOException
- If an I/O error occurspublic java.io.OutputStream _createOutputStream(java.lang.Object session, java.lang.String path, java.awt.Component comp) throws java.io.IOException
session
- the VFS sessionpath
- The pathcomp
- The component that will parent error dialog boxes
java.io.IOException
- If an I/O error occurspublic void _saveComplete(java.lang.Object session, Buffer buffer, java.lang.String path, java.awt.Component comp) throws java.io.IOException
session
- The VFS sessionbuffer
- The bufferpath
- 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
java.io.IOException
- If an I/O error occurspublic void _endVFSSession(java.lang.Object session, java.awt.Component comp) throws java.io.IOException
session
- The VFS sessioncomp
- The component that will parent error dialog boxes
java.io.IOException
- if an I/O error occurredpublic static java.awt.Color getDefaultColorFor(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |