Package io.github.jmcleodfoss.pst
Class BTreeOnHeap
java.lang.Object
io.github.jmcleodfoss.pst.ReadOnlyTreeModel
io.github.jmcleodfoss.pst.BTreeOnHeap
- All Implemented Interfaces:
BTreeNode
,TreeCustomNodeText
,TreeModel
public class BTreeOnHeap extends ReadOnlyTreeModel
The BTreeOnHeap class represents a B-tree contained on a heap defined by a node in the node B-tree.
- See Also:
- "[MS-PST] Outlook Personal Folders (.pst) File Format v20110608"
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BTreeOnHeap(HeapOnNode hon, PSTFile pstFile)
Construct a B-tree-on-heap structure with from the given heap-on-node structure and PST file object. -
Method Summary
Modifier and Type Method Description int
actualSize(io.github.jmcleodfoss.pst.BTree.Context<io.github.jmcleodfoss.pst.BTree,BTreeLeaf> context)
Obtain the actual size of the B-tree-on-heap object.Object
getChild(Object parent, int index)
Obtain the given child of this node.int
getChildCount(Object parent)
Get the number of children of this node.static ByteBuffer
getData(Object o, HeapOnNode hon)
Obtain data for the given leaf node, or null if the given object is not a leaf node.int
getIndexOfChild(Object parent, Object child)
Get the index of this child node in the given node.TableModel
getNodeTableModel()
Get a table model which can be used to describe this node.String
getNodeText()
Retrieve text for this node.String
getNodeText(Object value)
Obtain text suitable for display in a JTree node.Object
getRoot()
Get the root of the tree.boolean
isLeaf(Object node)
Is the given node a leaf node?io.github.jmcleodfoss.pst.BTree.Iterator
iterator()
Provide an iterator over the leaves of the B-tree.long
key()
Obtain the lookup key for this node.static void
main(String[] args)
Test this class by displaying the first B-tree-on-heap in the given PST file.void
outputString(PrintStream out, StringBuilder prefix)
Deprecated.ByteBuffer
rawData(io.github.jmcleodfoss.pst.BlockMap bbt, PSTFile pstFile)
Provide a mechanism to read the data from the node via a ByteBuffer.String
toString()
Provide a String which contains some information about this node.Methods inherited from class io.github.jmcleodfoss.pst.ReadOnlyTreeModel
addTreeModelListener, removeTreeModelListener, valueForPathChanged
-
Field Details
-
Constructor Details
-
BTreeOnHeap
Construct a B-tree-on-heap structure with from the given heap-on-node structure and PST file object. This function is intended to create the root of the B-tree.- Parameters:
hon
- The heap-on-node from which to derive this B-tree-on-heap.pstFile
- The PST file'sBTreeOnHeap.Header
, input stream, etc.- Throws:
IOException
- The PST file could not be read.
-
-
Method Details
-
actualSize
public int actualSize(io.github.jmcleodfoss.pst.BTree.Context<io.github.jmcleodfoss.pst.BTree,BTreeLeaf> context)Obtain the actual size of the B-tree-on-heap object.- Parameters:
context
- The context from which to create the B-tree-on-heap.- Returns:
- The actual size of a B-tree-on-heap object for this B-tree-on-heap.
-
getData
Obtain data for the given leaf node, or null if the given object is not a leaf node.- Parameters:
o
- The node to retrieve the data for.hon
- The heap-on-node from which the B-tree-on-heap is being built.- Returns:
- A read-only ByteBuffer containing the data in the leaf node.
- Throws:
UnsupportedEncodingException
- The PST file could not be read.
-
getNodeText
Retrieve text for this node.- Returns:
- A String which may be used to describe the node, typically within a JTree display for the B-tree.
-
main
Test this class by displaying the first B-tree-on-heap in the given PST file.- Parameters:
args
- The arguments to the test application.
-
getChild
Obtain the given child of this node. -
getChildCount
Get the number of children of this node.- Specified by:
getChildCount
in interfaceTreeModel
- Parameters:
parent
- The parent node to return the number of child nodes for.- Returns:
- The number of children of the given parent node.
-
getIndexOfChild
Get the index of this child node in the given node.- Specified by:
getIndexOfChild
in interfaceTreeModel
- Parameters:
parent
- The parent to search for child.child
- The child node to look for in parent.- Returns:
- The index of the given child in the given parent node, or -1 if it is not a child of parent.
-
getNodeTableModel
Get a table model which can be used to describe this node.- Specified by:
getNodeTableModel
in interfaceBTreeNode
- Returns:
- A TableModel describing this node.
-
getNodeText
Obtain text suitable for display in a JTree node.- Specified by:
getNodeText
in interfaceTreeCustomNodeText
- Parameters:
value
- The node object to obtain display text for.- Returns:
- A short text description of the node suitable for display in a JTree.
- See Also:
TreeCustomNodeText
-
getRoot
Get the root of the tree. -
isLeaf
Is the given node a leaf node? -
iterator
public io.github.jmcleodfoss.pst.BTree.Iterator iterator()Provide an iterator over the leaves of the B-tree.- Returns:
- An iterator over the leaves of the B-tree.
-
key
public long key()Obtain the lookup key for this node. -
outputString
Deprecated.Output this B-tree to the given stream. Each printed line begins with the String prefix, followed by a number of tabs which increases by one for each level This function is necessary because there can occasionally be too much information in a B-tree to use toString.- Parameters:
out
- The PrintStream object to write the tree to.prefix
- The prefix to use when printing this node.
-
rawData
public ByteBuffer rawData(io.github.jmcleodfoss.pst.BlockMap bbt, PSTFile pstFile) throws IOExceptionProvide a mechanism to read the data from the node via a ByteBuffer.- Specified by:
rawData
in interfaceBTreeNode
- Parameters:
bbt
- The PST file's block B-treepstFile
- The PST file's input data stream, header, etc.- Returns:
- A ByteBuffer containing the data for this leaf node of a B-tree.
- Throws:
IOException
- The PST file could not be read.
-
toString
Provide a String which contains some information about this node. This is typically used for debugging.
-