rossi.fstools.fs.reiserfs
Class Item

java.lang.Object
  extended byrossi.fstools.fs.reiserfs.Item
Direct Known Subclasses:
DirectItem, DirectoryItem, IndirectItem, StatDataItem

public class Item
extends java.lang.Object

Representation of a Item.

An item is an abstract data holder within a block.

Items are the fundamental unit of storage in ReiserFS. All data is packed into items which are in turn packed into blocks. Items have variable size and this is how ReiserFS achives low overhead on small files.

This class isnt typically used directly, rather on of the many subclasses is used.


Field Summary
protected  LeafNode block
           
protected  byte[] buffer
           
protected  int bufferOffset
           
protected  ItemHead header
           
 
Constructor Summary
Item(byte[] buffer, int bufferOffset, LeafNode block, ItemHead header)
          Create a new Item.
 
Method Summary
 LeafNode getBlock()
          Get the LeafNode that contains this item.
 BlockPointer getBlockPointer()
          Gets a block pointer to the item data.
 byte[] getBuffer()
          Get the buffer holding this item's data.
 int getBufferOffset()
          Get the offset within the buffer where this item's data starts.
 ItemHead getHeader()
          Get the item header for this item.
 byte[] getRawData()
          Get the raw data comprising this item.
 void setBlock(LeafNode aBlock)
           
 void setBuffer(byte[] aBuffer)
           
 void setBufferOffset(int aBufferOffset)
           
 void setHeader(ItemHead aHeader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected byte[] buffer

bufferOffset

protected int bufferOffset

block

protected LeafNode block

header

protected ItemHead header
Constructor Detail

Item

public Item(byte[] buffer,
            int bufferOffset,
            LeafNode block,
            ItemHead header)
Create a new Item.

Parameters:
buffer - a byte[] containing the item data
bufferOffset - a int specifying the offset within the buffer where the item starts.
block - a LeafNode containing this item.
header - a ItemHead - header for this item.
Method Detail

getBuffer

public byte[] getBuffer()
Get the buffer holding this item's data.

Returns:
byte[]

setBuffer

public void setBuffer(byte[] aBuffer)

getBufferOffset

public int getBufferOffset()
Get the offset within the buffer where this item's data starts.

Returns:
offset

setBufferOffset

public void setBufferOffset(int aBufferOffset)

getBlock

public LeafNode getBlock()
Get the LeafNode that contains this item.

Returns:
LeafNode parent

setBlock

public void setBlock(LeafNode aBlock)

getHeader

public ItemHead getHeader()
Get the item header for this item.

Returns:
ItemHead

setHeader

public void setHeader(ItemHead aHeader)

getBlockPointer

public BlockPointer getBlockPointer()
Gets a block pointer to the item data. This is useful for locating the item on disk.

Returns:
BlockPointer

getRawData

public byte[] getRawData()
Get the raw data comprising this item. This is a bit expensive since it does an array copy.