Package io.github.jmcleodfoss.pst
Class PagedBTree
java.lang.Object
io.github.jmcleodfoss.pst.ReadOnlyTreeModel
io.github.jmcleodfoss.pst.PagedBTree
- All Implemented Interfaces:
BTreeNode
,TreeCustomNodeText
,TreeModel
- Direct Known Subclasses:
NodeSubnodeBTree
public abstract class PagedBTree extends ReadOnlyTreeModel
The PagedBTree class is the base class for B-trees stored on pages within the PST file (i.e. the Node and Block B-trees).
- See Also:
- "[MS-PST] Outlook Personal Folders (.pst) File Format v20110608, section 2.2.2.7.7.1", BTPAGE (MSDN)
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
PagedBTree.PageContext<I extends io.github.jmcleodfoss.pst.BTree,L extends BTreeLeaf>
The PageContext class contains information required to keep track of the current position in the B-tree during input. -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
PagedBTree(long key, io.github.jmcleodfoss.pst.BREF bref, PagedBTree.PageContext<io.github.jmcleodfoss.pst.BTree,BTreeLeaf> context)
Construct a PageBTree object with the given search key from the given position using the given context. -
Method Summary
Modifier and Type Method Description int
actualSize(io.github.jmcleodfoss.pst.BTree.Context<io.github.jmcleodfoss.pst.BTree,BTreeLeaf> context)
Return the actual size of an intermediate B-tree entry as read in from the input datastream.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.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(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.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
-
PagedBTree
protected PagedBTree(long key, io.github.jmcleodfoss.pst.BREF bref, PagedBTree.PageContext<io.github.jmcleodfoss.pst.BTree,BTreeLeaf> context) throws IOExceptionConstruct a PageBTree object with the given search key from the given position using the given context.- Parameters:
key
- The key for this node.bref
- The block reference for this page.context
- The context from which to construct this B-Tree.- Throws:
IOException
- There was a problem reading the B-tree.
-
-
Method Details
-
actualSize
public int actualSize(io.github.jmcleodfoss.pst.BTree.Context<io.github.jmcleodfoss.pst.BTree,BTreeLeaf> context)Return the actual size of an intermediate B-tree entry as read in from the input datastream.- Parameters:
context
- The construction context for this B-tree.- Returns:
- The size of an intermediate node or block B-tree entry.
-
getNodeTableModel
Get a table model which can be used to describe this node.- Specified by:
getNodeTableModel
in interfaceBTreeNode
- Returns:
- A DefaultTableModel describing 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.- Returns:
- A string describing this B-tree.
-
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.
-
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.
-