|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBaseFileSystem
A BaseFileSystem represents a low-level file system in which files are referenced by file number. This is intended as a general low-level file system interface that could be implemented for many different file system structures. In UNIX, inode numbers play the role of file numbers.
Field Summary | |
private java.util.BitSet |
allBits
allBits is a bit set of all valid file numbers. |
private int |
capacity
capacity is the number of files in this base file system. |
private java.util.List |
files
files is the list of file accessors for this base file system. |
private java.util.BitSet |
freeBits
freeBits is a bit set of the file numbers that are not in use. |
private java.lang.String |
name
name is the name of this base file system. |
static int |
NO_FILE
BaseFileSystem.NO_FILE is the file number for nonexistent files. |
Constructor Summary | |
private |
BaseFileSystem()
This constructor is disabled. |
|
BaseFileSystem(java.lang.String nm,
int cap)
new BaseFileSystem(nm, cap) returns a new base file system with a capacity of cap files. |
Method Summary | |
int |
create(File f)
fs.create(f) returns the file number assigned to a new file f. |
int |
delete(int fn)
fs.delete(fn) removes the file with file number fn from fs and returns fn. |
java.util.Iterator |
files()
fs.files() returns an iterator for the files in fs. |
java.lang.String |
fileSet()
fs.fileSet() returns a string describing the set of files in fs. |
int |
getCapacity()
fs.getCapacity() returns the maximum number of files for fs. |
java.lang.String |
getName()
fs.getName() returns the file system name of fs as a string. |
static void |
main(java.lang.String[] args)
main(args) is a test program for the BaseFileSystem class. |
File |
open(int fn)
fs.open(fn) returns an accessor for the file with file number fn, or null if there is no such file. |
java.lang.String |
toString()
fs.toString() returns the class name and file system name of fs as a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NO_FILE
private java.lang.String name
private int capacity
private java.util.List files
private java.util.BitSet allBits
private java.util.BitSet freeBits
Constructor Detail |
private BaseFileSystem()
public BaseFileSystem(java.lang.String nm, int cap)
Method Detail |
public int create(File f)
public int delete(int fn)
public File open(int fn)
public int getCapacity()
public java.util.Iterator files()
public java.lang.String fileSet()
public java.lang.String getName()
public java.lang.String toString()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |