|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccs.cpc.VFile
public abstract class VFile
"Virtual file" - provides a common interface between files held on disk and those in archive virtual-filesystems. Implemented by ArchVFile, DiskVFile, ResultsVFile and ZipVFile.
A VFile is represented by two elements: a VDevice on which it sits, and its path within the "Filesystem" on that VDevice. A VDevice specifies a separator character. This separates directories from each other. The root directory is represented by a single separator character. The name of any (sub-) directory will end in a separator. The name of an actual file will not. (This stipulation will do to distinguish between subdirs and files if you have nothing else). The "path" of a file or directory is the complete specification excluding the VDevice. The "name" of a file or directory is everything on the path after the last separator (for a file; last-but-one for a directory since their paths end in a separator). This is not exactly how File behaves, for one - beware.
Nested Class Summary | |
---|---|
static class |
VFile.BasicRSSorter
|
static class |
VFile.ExtnSorter
|
static class |
VFile.NameSorter
|
Field Summary | |
---|---|
int |
hitpoints
Undocumented. |
boolean |
isSelected
Undocumented. |
Constructor Summary | |
---|---|
VFile(VDevice device,
VFile parent,
java.lang.String path,
boolean isDirectory)
Construct a VFile given a device and a complete path as described above. |
Method Summary | |
---|---|
abstract void |
acceptReal(java.lang.String leafname,
ccs.utils.SwappingBuffer data)
Directories: copy this data into yourself, creating a VFile for it. |
void |
acceptVirtual(VFile leaf)
Directories: accept this VFile. |
abstract boolean |
contains(java.lang.String leafname)
Directories: have you a file called this? |
ccs.http.HProgressMonitor |
createRealiseMonitor()
|
void |
disposeRealiseMonitor(ccs.http.HProgressMonitor rmon)
|
boolean |
equals(java.lang.Object o)
|
java.lang.String |
fsanitise(java.lang.String name)
Some subclasses may support filenames which aren't supported by Files. |
abstract VFile |
getContainee(java.lang.String leafname)
Directories: you contain this, we'd like it. |
abstract VFile[] |
getContents()
Directories: your contents please. |
java.lang.String |
getDecoratedName()
A complete representation of the VFile. |
VDevice |
getDevice()
return the VDevice this sits on. |
java.lang.String |
getDisplayName(VFile vf)
Directories: return the display name of the supplied VFile. |
java.lang.String |
getID()
Returns a unique ID for the file. |
abstract VFileMeta |
getMetadata()
Return metadata for yourself, if available. |
java.lang.String |
getName()
Return the leaf name (ie path - parent). |
VFile |
getParent()
return the parent object. |
java.lang.String |
getPath()
return the complete path. |
abstract long |
getSize()
Files: return your size, if known, else -1L. |
VFile |
getTrackingParent()
Return your parent folder for tracking purposes. |
int |
hashCode()
|
protected boolean |
hasInternalSeparator(java.lang.String name)
Whether a file name contains an internal path-separator char. |
boolean |
isDir()
Is this a directory? |
abstract boolean |
isExist()
Does this file still exist? |
boolean |
isRealiseInstant()
For leaf nodes: can you realise a file instantly? |
abstract boolean |
isWritable()
whether this vfile can be updated (i.e. virtualised). |
abstract void |
mkdir(java.lang.String leafname)
Directories: create this subdir. |
protected java.lang.String |
normaliseName(java.lang.String name,
boolean isFolder)
Normalise the name of a leaf node. |
void |
postrecursionHook(boolean isRoot)
Directories: we've finished recursing through you. |
void |
prerecursionHook(boolean isRoot)
Directories: prepare to be recursed through. |
abstract ccs.utils.SwappingBuffer |
realiseAsBuffer()
For leaf nodes, put your data into a SwappingBuffer. |
abstract java.io.File |
realiseAsFile()
For leaf nodes: turn this VFile into a disk File. |
abstract void |
rename(VFile vf,
java.lang.String newname)
Directories: rename the attached VFile to the name given. |
java.lang.String |
toString()
|
abstract void |
virtualiseFromFile(java.io.File f,
boolean maybeChanged)
For leaf nodes, your contents becomes the contents of the supplied physical file (which is usually an updated form of the result of a realise() earlier). |
abstract void |
virtualiseFromWad(byte[] wad,
boolean maybeChanged)
For leaf nodes, your contents become the contents of the supplied wad. |
abstract void |
wipe(VFile vf)
Directories: wipe this VFile and its contents from the face of the world. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean isSelected
public int hitpoints
Constructor Detail |
---|
public VFile(VDevice device, VFile parent, java.lang.String path, boolean isDirectory)
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public java.lang.String fsanitise(java.lang.String name)
public final ccs.http.HProgressMonitor createRealiseMonitor() throws java.io.IOException
java.io.IOException
public final void disposeRealiseMonitor(ccs.http.HProgressMonitor rmon)
public abstract java.io.File realiseAsFile() throws java.io.IOException
realiseAsBuffer
to suppress redundant copies.
This is an identity operation for DiskVFiles.
java.io.IOException
public boolean isRealiseInstant()
public abstract void virtualiseFromFile(java.io.File f, boolean maybeChanged) throws java.io.IOException
java.io.IOException
public abstract ccs.utils.SwappingBuffer realiseAsBuffer() throws java.io.IOException
java.io.IOException
public abstract void virtualiseFromWad(byte[] wad, boolean maybeChanged) throws java.io.IOException
java.io.IOException
public abstract boolean isWritable() throws java.io.IOException
java.io.IOException
public final java.lang.String getPath()
public final VFile getParent()
public final java.lang.String getName()
public final VDevice getDevice()
public final java.lang.String getID()
public final java.lang.String getDecoratedName()
public abstract boolean isExist() throws java.io.IOException
java.io.IOException
public final boolean isDir()
public java.lang.String getDisplayName(VFile vf)
public abstract boolean contains(java.lang.String leafname) throws java.io.IOException
java.io.IOException
public abstract VFile getContainee(java.lang.String leafname) throws java.io.IOException
java.io.IOException
public abstract VFile[] getContents() throws java.io.IOException
java.io.IOException
public abstract void mkdir(java.lang.String leafname) throws java.io.IOException
java.io.IOException
public abstract void acceptReal(java.lang.String leafname, ccs.utils.SwappingBuffer data) throws java.io.IOException
java.io.IOException
public void acceptVirtual(VFile leaf) throws java.io.IOException
java.io.IOException
public abstract void wipe(VFile vf) throws java.io.IOException, ccs.LoseException, ccs.ArghException
java.io.IOException
ccs.LoseException
ccs.ArghException
public abstract void rename(VFile vf, java.lang.String newname) throws java.io.IOException, ccs.LoseException, ccs.ArghException
java.io.IOException
ccs.LoseException
ccs.ArghException
public abstract VFileMeta getMetadata() throws java.io.IOException
java.io.IOException
public abstract long getSize() throws java.io.IOException
getMetadata
- hopefully this is slightly lighter
weight.
java.io.IOException
public VFile getTrackingParent()
public void prerecursionHook(boolean isRoot)
public void postrecursionHook(boolean isRoot)
protected java.lang.String normaliseName(java.lang.String name, boolean isFolder)
hasInternalSeparator
to check
for this if you have a problem with it.
name
- The name to be normalisedisFolder
- Whether this is the name of a folder.
protected boolean hasInternalSeparator(java.lang.String name)
name
- The name to check.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |