|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.io.MultiFileSystem
public class MultiFileSystem
Combines several FileSystems into one providing transparent
access to all of them. Operations involving lookup of a file system based
on a Locator have O(N) performance where N is
the number of FileSystems associated with this
MultiFileSystem. The lookup is done by calling
FileSystem.isContained(Locator) on every file system until a
file system returns true.
Subclasses may override the lookup(Locator) method to change the
lookup implementation.
| Constructor Summary | |
|---|---|
MultiFileSystem()
Creates an empty MultiFileSystem. |
|
MultiFileSystem(FileSystem allocFs)
Creates a MultiFileSystem using the specified
file system for allocation of new data. |
|
| Method Summary | |
|---|---|
void |
addFileSystem(FileSystem fs)
Adds the specified file system to this MultiFileSystem. |
Bound |
all()
Allocates data in the file system designated for new allocations. |
Bound |
allocate()
Allocates data in the file system designated for new allocations. |
Bound |
allocate(long size)
Allocates data in the file system designated for new allocations. |
void |
clear()
Frees all data in this FileSystem. |
void |
clearModified()
Clears the modified status of all the file systems. |
void |
close()
Closes all the contained file systems. |
void |
free(Bound l)
Frees the space occupied by the specified Bound. |
FileSystem |
getAllocationFileSystem()
Returns the file system designated for new allocations of data or null if none exists. |
PositionalData |
getData(Locator l)
Returns a PositionalData for reading and writing to the
FileSystem at the specified location. |
Bound |
getMeta()
Unsupported - returns null. |
SourceId |
id()
Returns the SourceId of the allocation file system. |
boolean |
isContained(Locator l)
Returns true if and only if the specified locator is
contained in any of the file systems associated with this
MultiFileSystem. |
boolean |
isModified()
Returns true if any of the file systems are modified. |
boolean |
isReadOnly()
Returns true only if all the file systems are read-only. |
FileSystem |
lookup(Locator l)
Returns the FileSystem containing the specified locator or
returns null if none of the file systems contains the
locator. |
void |
removeFileSystem(FileSystem fs)
Removes the specified file system from this MultiFileSystem. |
void |
setAllocationFileSystem(FileSystem allocFs)
Sets the file system designated for new allocations of data. |
void |
setMeta(Bound b)
Unsupported. |
void |
setReadOnly(boolean isReadOnly)
Sets the read-only status of all the file systems. |
long |
size()
Returns the total size of all associated file systems. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MultiFileSystem()
MultiFileSystem.
Allocation operations will not be supported.
public MultiFileSystem(FileSystem allocFs)
MultiFileSystem using the specified
file system for allocation of new data. That file system will also
be considered part of this file system.
| Method Detail |
|---|
public void addFileSystem(FileSystem fs)
MultiFileSystem.
public void removeFileSystem(FileSystem fs)
MultiFileSystem.
public FileSystem getAllocationFileSystem()
null if none exists.
public void setAllocationFileSystem(FileSystem allocFs)
MultiFileSystem. Any previous allocation file system will
not be removed automatically.
public SourceId id()
throws IOException
SourceId of the allocation file system.
id in interface FileSystemIOException
public Bound allocate()
throws IOException
allocate in interface FileSystemIOException - if an I/O error occurred.
public Bound allocate(long size)
throws IOException
allocate in interface FileSystemIOException - if an I/O error occurred or the specified amount of
bytes could not be allocated.
public Bound all()
throws IOException
all in interface FileSystemIOException - if an I/O error occurred.
public void free(Bound l)
throws IOException
FileSystemBound.
free in interface FileSystemIOException - if an I/O error occurred.
InvalidSourceIdException - if the file system identifier of
the locator is invalid.
OutOfBoundsException - if the locator is out of bounds.
public Bound getMeta()
throws IOException
null.
getMeta in interface FileSystemIOException
public void setMeta(Bound b)
throws IOException
setMeta in interface FileSystemIOException
public void clear()
throws IOException
FileSystemFileSystem.
clear in interface FileSystemIOException
public PositionalData getData(Locator l)
throws IOException
FileSystemPositionalData for reading and writing to the
FileSystem at the specified location.
getData in interface FileSystemIOException - if an I/O error occurred.
InvalidSourceIdException - if the file system identifier of
the locator is invalid.
OutOfBoundsException - if the locator is out of bounds.
public long size()
throws IOException
size in interface FileSystemIOException - if an I/O error occurred.
public boolean isModified()
throws IOException
true if any of the file systems are modified.
isModified in interface FileSystemIOException
public void clearModified()
throws IOException
clearModified in interface FileSystemIOException
public boolean isReadOnly()
throws IOException
true only if all the file systems are read-only.
isReadOnly in interface FileSystemIOException
public void setReadOnly(boolean isReadOnly)
throws IOException
setReadOnly in interface FileSystemIOException
public void close()
throws IOException
close in interface FileSystemIOException - if an I/O error occurred.public boolean isContained(Locator l)
true if and only if the specified locator is
contained in any of the file systems associated with this
MultiFileSystem.
isContained in interface FileSystem
public FileSystem lookup(Locator l)
throws IOException
FileSystem containing the specified locator or
returns null if none of the file systems contains the
locator. Subclasses may override this method to change lookup
implementation.
IOExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||