|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.kernel.filesys.DirectoryEntry
class DirectoryEntry
This class defines a "directory entry", representing a file in the directory. Each entry gives the name of the file, and where the file's header is to be found on disk. Internal data structures kept non-private so that Directory operations can access them directly.
Field Summary | |
---|---|
(package private) static int |
FileNameMaxLen
Maximum length of a file name. |
private boolean |
inUse
Is this directory entry in use? |
private java.lang.String |
name
Text name for file (must be representable by a sequence of bytes no longer than FileNameMaxLen). |
private byte[] |
nameBytes
On-disk representation of the file name. |
private int |
nameLen
Length of filename. |
private int |
sector
Location on disk to find the FileHeader for this file. |
Constructor Summary | |
---|---|
DirectoryEntry()
|
Method Summary | |
---|---|
(package private) void |
externalize(byte[] buffer,
int pos)
Export the fields of this DirectoryEntry object to a buffer in a format suitable for writing to the disk. |
(package private) java.lang.String |
getName()
Get the file name stored in this DirectoryEntry. |
(package private) int |
getSector()
Get the sector number stored in this DirectoryEntry. |
(package private) void |
internalize(byte[] buffer,
int pos)
Initialize the fields of this DirectoryEntry object using data read from the disk. |
(package private) boolean |
inUse()
Determine if this DirectoryEntry is in use. |
(package private) void |
setUnused()
Mark this directory entry as "unused". |
(package private) boolean |
setUsed(java.lang.String name,
int sector)
Mark this directory entry as "in use" and set the file name and disk sector number. |
static int |
sizeOf()
Calculate size of on-disk representation of a DirectoryEntry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int FileNameMaxLen
private boolean inUse
private int sector
private int nameLen
private java.lang.String name
private byte[] nameBytes
Constructor Detail |
---|
DirectoryEntry()
Method Detail |
---|
boolean inUse()
java.lang.String getName()
int getSector()
boolean setUsed(java.lang.String name, int sector)
name
- The name of the file.sector
- The disk sector number of the file header.
void setUnused()
public static int sizeOf()
void internalize(byte[] buffer, int pos)
buffer
- A buffer holding the data read from the disk.pos
- Position in the buffer at which to start.void externalize(byte[] buffer, int pos)
buffer
- A buffer into which to place the exported data.pos
- Position in the buffer at which to start.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |