rossi.fstools.fs.reiserfs
Class InternalNode

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

public class InternalNode
extends FBlock

Representation of an internal node of the B+Tree. Following the block header (at offset 0x18), is an array of N Keys, followed by an array of (N+1) DiskChild pointers. The remainder of the block is free space.


Field Summary
protected  byte[] freeSpaceData
           
protected  Key[] keys
           
protected  DiskChild[] ptrs
           
 
Fields inherited from class rossi.fstools.fs.reiserfs.FBlock
blocknum, freeSpace, level, numItems, parent, reserved, rightKey, sb
 
Constructor Summary
InternalNode(ReiserSuperBlock sb, int blocknum)
          Create an internal node.
 
Method Summary
 byte[] getFreeSpaceData()
          Get the free space in this node.
 Key[] getKeys()
          Get the keys contained in this internal node.
 DiskChild getPointerForKey(Key k)
          Convieince method for searching the tree.
 DiskChild[] getPtrs()
          Get the disk child pointers in this node.
 void loadFromBuffer(byte[] buffer, int offset)
          Load this structure from disk.
 void setFreeSpaceData(byte[] aFreeSpace)
           
 void setKeys(Key[] aKeys)
           
 void setPtrs(DiskChild[] aPtrs)
           
 
Methods inherited from class rossi.fstools.fs.reiserfs.FBlock
createFromBuffer, getBlockHeaderSize, getBlockNum, getDataSize, getFreeSpace, getLevel, getNumItems, getParent, getReserved, getRightKey, getSuperBlock, setFreeSpace, setLevel, setNumItems, setParent, setReserved, setRightKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keys

protected Key[] keys

ptrs

protected DiskChild[] ptrs

freeSpaceData

protected byte[] freeSpaceData
Constructor Detail

InternalNode

public InternalNode(ReiserSuperBlock sb,
                    int blocknum)
Create an internal node.

Parameters:
sb - ReiserSuperBlock - superblock of this filesystem
blocknum - block number of this block
Method Detail

getKeys

public Key[] getKeys()
Get the keys contained in this internal node.

Returns:
array of keys

setKeys

public void setKeys(Key[] aKeys)

getPtrs

public DiskChild[] getPtrs()
Get the disk child pointers in this node.

Returns:
array of DiskChild pointers

setPtrs

public void setPtrs(DiskChild[] aPtrs)

getFreeSpaceData

public byte[] getFreeSpaceData()
Get the free space in this node.

Returns:
buffer of free space.

setFreeSpaceData

public void setFreeSpaceData(byte[] aFreeSpace)

getPointerForKey

public DiskChild getPointerForKey(Key k)
Convieince method for searching the tree.

Returns:
the DiskChild pointer for the given key.

loadFromBuffer

public void loadFromBuffer(byte[] buffer,
                           int offset)
                    throws FsException
Description copied from class: FBlock
Load this structure from disk.

Specified by:
loadFromBuffer in interface DiskStructure
Overrides:
loadFromBuffer in class FBlock
Throws:
FsException - if a parse error occurs
See Also:
DiskStructure.loadFromBuffer(byte[], int)