|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ccs.cpc.VFile ccs.cpc.impl.ResultWrapperVFile
class ResultWrapperVFile
Wraps a VFile which is in a result set. (The root VFile of a ResultsVDevice is a ResultsVFile; the ResultsVFile stores a list of ResultWrapperVFiles, each of which wraps an arbitrary VFile.) The wrapper delegates all of its VFile behaviour to the wrapped VFile inside it, but has extra API which is used to manage the result set. In particular, the wrapper makes it possible to distinguish two references to the same VFile within a result set; this ensures that tracking will work correctly. Only ResultsVFiles should ever create these. Synchronisation is handled by the owning ResultsVFile. All API which isn't part of VFile is reserved for ResultsVFile.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ccs.cpc.VFile |
---|
VFile.BasicRSSorter, VFile.ExtnSorter, VFile.NameSorter |
Field Summary |
---|
Fields inherited from class ccs.cpc.VFile |
---|
hitpoints, isSelected |
Constructor Summary | |
---|---|
ResultWrapperVFile(ResultsVFile resultsVFile,
VFile vf,
int refcount,
ResultWrapperVFile prev)
Ctor. |
Method Summary | |
---|---|
void |
acceptReal(java.lang.String leafname,
ccs.utils.SwappingBuffer data)
Directories: copy this data into yourself, creating a VFile for it. |
boolean |
contains(java.lang.String leafname)
Directories: have you a file called this? |
(package private) void |
decRefcount()
|
VFile |
getContainee(java.lang.String leafname)
Directories: you contain this, we'd like it. |
VFile[] |
getContents()
Directories: your contents please. |
VFileMeta |
getMetadata()
Return metadata for yourself, if available. |
(package private) ResultWrapperVFile |
getNext()
|
(package private) VFile |
getPayload()
|
(package private) ResultWrapperVFile |
getPrev()
|
(package private) int |
getRefcount()
|
long |
getSize()
Files: return your size, if known, else -1L. |
VFile |
getTrackingParent()
Return your parent folder for tracking purposes. |
boolean |
isExist()
Does this file still exist? |
(package private) boolean |
isUnreferenced()
|
boolean |
isWritable()
whether this vfile can be updated (i.e. virtualised). |
void |
mkdir(java.lang.String leafname)
Directories: create this subdir. |
ccs.utils.SwappingBuffer |
realiseAsBuffer()
For leaf nodes, put your data into a SwappingBuffer. |
java.io.File |
realiseAsFile()
For leaf nodes: turn this VFile into a disk File. |
void |
rename(VFile bratvf,
java.lang.String newname)
Directories: rename the attached VFile to the name given. |
(package private) void |
unlink()
|
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). |
void |
virtualiseFromWad(byte[] wad,
boolean maybeChanged)
For leaf nodes, your contents become the contents of the supplied wad. |
void |
wipe(VFile bratvf)
Directories: wipe this VFile and its contents from the face of the world. |
Methods inherited from class ccs.cpc.VFile |
---|
acceptVirtual, createRealiseMonitor, disposeRealiseMonitor, equals, fsanitise, getDecoratedName, getDevice, getDisplayName, getID, getName, getParent, getPath, hashCode, hasInternalSeparator, isDir, isRealiseInstant, normaliseName, postrecursionHook, prerecursionHook, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
ResultWrapperVFile(ResultsVFile resultsVFile, VFile vf, int refcount, ResultWrapperVFile prev)
resultsVFile
- The result set this wrapper belongs to.vf
- The VFile this wraps. NB. a wrapper can wrap another wrapper,
and so on ad infinitum; any such "inner wrappers" tunnel straight through
to the real VFile at the end and effectively don't exist.refcount
- The resultsVFile maintains a mapping between decorated names
and the (wrappers around each of the) VFiles that they name. Each wrapper
maintains a count of how many entries in the result set's entry list refer
to the specified name; a mapping is deleted when the ref count reaches zero.Method Detail |
---|
int getRefcount()
void decRefcount()
boolean isUnreferenced()
ResultWrapperVFile getNext()
ResultWrapperVFile getPrev()
void unlink()
VFile getPayload()
public VFile getTrackingParent()
VFile
getTrackingParent
in class VFile
public void acceptReal(java.lang.String leafname, ccs.utils.SwappingBuffer data) throws java.io.IOException
VFile
acceptReal
in class VFile
java.io.IOException
public boolean contains(java.lang.String leafname) throws java.io.IOException
VFile
contains
in class VFile
java.io.IOException
public VFile getContainee(java.lang.String leafname) throws java.io.IOException
VFile
getContainee
in class VFile
java.io.IOException
public VFile[] getContents() throws java.io.IOException
VFile
getContents
in class VFile
java.io.IOException
public VFileMeta getMetadata() throws java.io.IOException
VFile
getMetadata
in class VFile
java.io.IOException
public long getSize() throws java.io.IOException
VFile
getMetadata
- hopefully this is slightly lighter
weight.
getSize
in class VFile
java.io.IOException
public boolean isExist() throws java.io.IOException
VFile
isExist
in class VFile
java.io.IOException
public boolean isWritable() throws java.io.IOException
VFile
isWritable
in class VFile
java.io.IOException
public void mkdir(java.lang.String leafname) throws java.io.IOException
VFile
mkdir
in class VFile
java.io.IOException
public ccs.utils.SwappingBuffer realiseAsBuffer() throws java.io.IOException
VFile
realiseAsBuffer
in class VFile
java.io.IOException
public java.io.File realiseAsFile() throws java.io.IOException
VFile
realiseAsBuffer
to suppress redundant copies.
This is an identity operation for DiskVFiles.
realiseAsFile
in class VFile
java.io.IOException
public void rename(VFile bratvf, java.lang.String newname) throws java.io.IOException, ccs.LoseException, ccs.ArghException
VFile
rename
in class VFile
java.io.IOException
ccs.LoseException
ccs.ArghException
public void virtualiseFromFile(java.io.File f, boolean maybeChanged) throws java.io.IOException
VFile
virtualiseFromFile
in class VFile
java.io.IOException
public void virtualiseFromWad(byte[] wad, boolean maybeChanged) throws java.io.IOException
VFile
virtualiseFromWad
in class VFile
java.io.IOException
public void wipe(VFile bratvf) throws java.io.IOException, ccs.LoseException, ccs.ArghException
VFile
wipe
in class VFile
java.io.IOException
ccs.LoseException
ccs.ArghException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |