|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.borland.primetime.vfs.VFS
The VFS, or Virtual File System, is responsible for mapping a Url to a buffer representing its contents. The VFS serves as a global cache of Buffer instances, mapping Url descriptions to existing in-memory buffers when possible, and creating new buffers as necessary.
All attempts to manipulate a Url through the VFS are directed to the filesystem associated with the Url.
Buffer
,
Filesystem
Field Summary | |
static int |
BLOCK_SIZE
|
Method Summary | |
static void |
addVFSListener(VFSListener listener)
Adds a VFSListener to the list of listeners that receive VFS events. |
static void |
copy(Url sourceUrl,
Url targetUrl)
Copies a resource, duplicating both the state of buffers and the persistant storage state. |
static void |
copyStream(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Copies the contents of an InputStream to an OutputStream. |
static void |
delete(Url url)
Deletes the specified resource from permanent storage and ensures that its buffer, if in memory, has been emptied and marked as unmodified. |
static boolean |
exists(Url url)
Tests if the specified resource actually exists. |
static Buffer |
findBuffer(Url url)
Checks the cache for an existing reference to the underlying buffer. |
static void |
fireBufferConflict(Buffer buffer)
Notifies all registered VFSListeners that the content of the buffer has been changed in memory and on disk and that the resulting conflict needs to be resolved. |
static Buffer |
getBuffer(Url url)
Returns an instance of the appropriate Buffer subclass to represent the contents of a Url. |
static Url |
getCanonicalUrl(Url url)
Reports the exact Url representation of a resource. |
static Url[] |
getChildren(Url url,
int type)
Retrieves a list of children within a resource, such as files within a directory. |
static Url[] |
getChildren(Url url,
RegularExpression[] patterns,
int type)
Retrieves a list of children within a resource, such as files within a directory. |
static Url[] |
getChildren(Url url,
RegularExpression pattern,
int type)
Retrieves a list of children within a resource, such as files within a directory. |
static java.io.InputStream |
getInputStream(Url url)
Creates an InputStream that reads from the specified Url. |
static long |
getLastModified(Url url)
Reports the time at which the contents of this resource were last modified. |
static java.io.OutputStream |
getOutputStream(Url url)
Creates an OutputStream that writes to the specified Url. |
static java.io.OutputStream |
getOutputStream(Url url,
boolean createBackup)
Creates an OutputStream that writes to the specified Url. |
static boolean |
isAutoBackupEnabled()
Reports the current default behavior for backing up files before writing to them via getOutputStream(). |
static boolean |
isDirectory(Url url)
Tests if the specified resource represents a container of other resources. |
static boolean |
isReadOnly(Url url)
Tests if the specified resource is read-only. |
static void |
removeVFSListener(VFSListener listener)
Removes a VFSListener from the list of listeners that receive VFS events. |
static void |
rename(Url oldUrl,
Url newUrl)
Renames a resource by making a copy and deleting the original. |
static void |
setAutoBackupEnabled(boolean enabled)
Changes the current default behavior for backing up files before writing to them via getOutputStream(). |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int BLOCK_SIZE
Method Detail |
public static void copyStream(java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.io.IOException
public static Buffer getBuffer(Url url) throws java.io.IOException
revert
method.url
- The resource for which a buffer is desired.public static Buffer findBuffer(Url url)
url
- The Url key used to locate the desired buffer.public static java.io.InputStream getInputStream(Url url) throws java.io.IOException
url
- The resource to be read.public static boolean isAutoBackupEnabled()
public static void setAutoBackupEnabled(boolean enabled)
enabled
- True if auto-backup should be enabled, false otherwise.public static java.io.OutputStream getOutputStream(Url url) throws VFSException, java.io.IOException
getBuffer
and use its
getOutputStream
method instead.
The current setting for automatic backups is used to determine whether or not a backup file should be created.
url
- The resource to be written.public static java.io.OutputStream getOutputStream(Url url, boolean createBackup) throws VFSException, java.io.IOException
getBuffer
and use its
getOutputStream
method instead.url
- The resource to be written.createBackup
- True if a backup file should be created, false
otherwise.public static boolean isReadOnly(Url url)
url
- The resource to be tested.public static long getLastModified(Url url)
url
- The resource to be tested.public static Url getCanonicalUrl(Url url)
url
- The resource.public static boolean exists(Url url)
url
- The resource to be tested.public static boolean isDirectory(Url url)
url
- The resource to be tested.public static Url[] getChildren(Url url, int type)
Retrieves a list of children within a resource, such as files within a directory.
url
- The container resource.type
- The constants TYPE_DIRECTORY
,
TYPE_FILE
, and TYPE_BOTH
can be used to control
the type of resources that are represented in the result array.public static Url[] getChildren(Url url, RegularExpression pattern, int type)
Retrieves a list of children within a resource, such as files within a directory.
url
- The container resource.pattern
- A regular expression constraining the set of values that
will be returned. Only children whose final path component exactly
matches the pattern will be represented in the resulting array. Note that
directories are not compared against the pattern, only files.type
- The constants TYPE_DIRECTORY
,
TYPE_FILE
, and TYPE_BOTH
can be used to control
the type of resources that are represented in the result array.public static Url[] getChildren(Url url, RegularExpression[] patterns, int type)
Retrieves a list of children within a resource, such as files within a directory.
url
- The container resource.pattern
- An array of regular expressions constraining the set of
values that will be returned. Only children whose final path component
exactly matches at least one of the patterns will be represented in the
resulting array. Note that a null array matches all children and that
directories are not compared against the patterns, only files.type
- The constants TYPE_DIRECTORY
,
TYPE_FILE
, and TYPE_BOTH
can be used to control
the type of resources that are represented in the result array.public static void delete(Url url) throws java.io.IOException
url
- The resource to be deleted.public static void rename(Url oldUrl, Url newUrl) throws java.io.IOException, java.io.FileNotFoundException, ReadOnlyException
sourceUrl
- The resource's current Url.desinationUrl
- The resource's desired Url.public static void copy(Url sourceUrl, Url targetUrl) throws java.io.IOException
If the target Url already exists, copy will silently overwrite it.
sourceUrl
- The resource to copy from.targetUrl
- The resource to copy to.public static void addVFSListener(VFSListener listener)
listener
- The listener.public static void removeVFSListener(VFSListener listener)
listener
- The listener.public static void fireBufferConflict(Buffer buffer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |