rossi.fstools.fs.reiserfs
Class ItemHead

java.lang.Object
  extended byrossi.fstools.fs.reiserfs.ItemHead
All Implemented Interfaces:
DiskStructure

public class ItemHead
extends java.lang.Object
implements DiskStructure

Representation of a ItemHead.

Item Head is an intrablock pointer to an item.

        31        24        16       8       0
        --------------------------------------
  0000  |        Key                         |
        --------------------------------------
  0004  |        Key                         |
        --------------------------------------
  0008  |        Key                         |
        --------------------------------------
  000C  |        Key                         |
        --------------------------------------
  0010  | Free/EntCount    |  Item Length    |
        --------------------------------------
  0014  |  Item Location   |  Item Version   |
        --------------------------------------
 


Field Summary
protected  int freeEntCt
           
protected  int itemLen
           
protected  int itemLocation
           
protected  int itemVersion
           
protected  Key key
           
 
Constructor Summary
ItemHead()
           
 
Method Summary
 int getDataSize()
          Get the size in bytes of the structure.
 int getFreeEntCt()
          Get the number of entries if this is a DirectoryItem, or the free space if this is a indirect item.
 int getItemLen()
          Get the length of this Item in bytes.
 int getItemLocation()
          Location of the item within this block.
 int getItemVersion()
          Indicates the item version.
 Key getKey()
          Get the Key of the item.
 void loadFromBuffer(byte[] buffer, int blkoffset)
          Loads the object from a memory buffer
 void setFreeEntCt(int aFreeEntCt)
           
 void setItemLen(int aItemLen)
           
 void setItemLocation(int aItemLocation)
           
 void setItemVersion(int aItemVersion)
           
 void setKey(Key aKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

protected Key key

freeEntCt

protected int freeEntCt

itemLen

protected int itemLen

itemLocation

protected int itemLocation

itemVersion

protected int itemVersion
Constructor Detail

ItemHead

public ItemHead()
Method Detail

getDataSize

public int getDataSize()
Description copied from interface: DiskStructure
Get the size in bytes of the structure. For variable length sturctures this may represent the minimum length rather than the actual length.

Specified by:
getDataSize in interface DiskStructure
Returns:
the size of the structure.

getKey

public Key getKey()
Get the Key of the item. The key is used to associate directory entries to items.

Returns:
the key

setKey

public void setKey(Key aKey)

getFreeEntCt

public int getFreeEntCt()
Get the number of entries if this is a DirectoryItem, or the free space if this is a indirect item.

Returns:
free space or entry count

setFreeEntCt

public void setFreeEntCt(int aFreeEntCt)

getItemLen

public int getItemLen()
Get the length of this Item in bytes.

Returns:
item length.

setItemLen

public void setItemLen(int aItemLen)

getItemLocation

public int getItemLocation()
Location of the item within this block.

Returns:
item location.

setItemLocation

public void setItemLocation(int aItemLocation)

getItemVersion

public int getItemVersion()
Indicates the item version.

0 for old items, 2 for new items.

Returns:
item version.

setItemVersion

public void setItemVersion(int aItemVersion)

loadFromBuffer

public void loadFromBuffer(byte[] buffer,
                           int blkoffset)
                    throws FsException
Description copied from interface: DiskStructure
Loads the object from a memory buffer

Specified by:
loadFromBuffer in interface DiskStructure
Parameters:
buffer - a byte[] containing data to be read in populating the object
blkoffset - a int indicating the offset within the buffer to start parsing.
Throws:
FsException - if a parse error occurs.