rossi.fstools.fs.reiserfs
Class DirEntry

java.lang.Object
  extended byrossi.fstools.fs.reiserfs.DirEntry

public class DirEntry
extends java.lang.Object

Representation of a Directory Entry.

An item is an abstract data holder within a block.

A directory has an array of directory entry items at the beginning, the names corresponding to those entries are packed in at the end of the item.

These directory entries are at the beginning of the directory item. For convienece when these are loaded from a directory item, the name is associated with the entry is also parsed.

        31        24        16       8       0
        --------------------------------------
  0000  |        Offset (hash code)          |
        --------------------------------------
  0004  |        Parent Dir Id               |
        --------------------------------------
  0008  |        Object Id                   |
        --------------------------------------
  000C  |  Location        |     State       |
        --------------------------------------
 


Field Summary
protected  long hash
           
protected  int location
           
protected  java.lang.String name
           
protected  long objectId
           
protected  long parentDirId
           
protected  int state
           
 
Constructor Summary
DirEntry()
           
 
Method Summary
 long getHash()
          Get the hash code for the directory name.
 int getLocation()
          Location of this directory entry within the directory item.
 java.lang.String getName()
          Name of the item in the directory.
 long getObjectId()
          Get the identifier of this object.
 long getParentDirId()
          Get the identifier of this object's parent directory.
 int getState()
           
 void loadFromBuffer(byte[] buffer, int itemoffset, int entrynum, int end)
          Loads a directory entry.
 void setHash(long aHash)
           
 void setLocation(int aLocation)
           
 void setName(java.lang.String aName)
           
 void setObjectId(long aObjectId)
           
 void setParentDirId(long aParentDirId)
           
 void setState(int aState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hash

protected long hash

parentDirId

protected long parentDirId

objectId

protected long objectId

location

protected int location

state

protected int state

name

protected java.lang.String name
Constructor Detail

DirEntry

public DirEntry()
Method Detail

getHash

public long getHash()
Get the hash code for the directory name. ReiserFS uses this for indexed directory lookups.

Returns:
the hash

setHash

public void setHash(long aHash)

getParentDirId

public long getParentDirId()
Get the identifier of this object's parent directory. Together with the object ID, this forms the key into the tree to find the object.

Returns:
parent's ID

setParentDirId

public void setParentDirId(long aParentDirId)

getObjectId

public long getObjectId()
Get the identifier of this object. Together with the parent directory ID, this forms the key into the tree to find the object.

Returns:
long

setObjectId

public void setObjectId(long aObjectId)

getLocation

public int getLocation()
Location of this directory entry within the directory item.

Returns:
location

setLocation

public void setLocation(int aLocation)

getState

public int getState()

setState

public void setState(int aState)

getName

public java.lang.String getName()
Name of the item in the directory. The filename.

Returns:
the filename

setName

public void setName(java.lang.String aName)

loadFromBuffer

public void loadFromBuffer(byte[] buffer,
                           int itemoffset,
                           int entrynum,
                           int end)
                    throws FsException
Loads a directory entry.

Parameters:
buffer - Buffer holding our item.
itemoffset - Item offset is an offset within buffer to the start of the item data.
entrynum - is the ordinal of the direntry to load.
end - offset where the directory name must end
Throws:
FsException