Class 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)
  • Field Details

    • logger

      protected static Logger logger
      Logger for debugging BTree-derived classes
    • children

      protected final BTreeNode[] children
      The children of this B-tree node. The children may be either intermediate nodes, which are themselves B-trees, or leaf nodes.
    • key

      protected final long key
      The key of this node is guaranteed to be the smallest key of any of its children.
  • Constructor Details

    • PagedBTree

      protected PagedBTree​(long key, io.github.jmcleodfoss.pst.BREF bref, PagedBTree.PageContext<io.github.jmcleodfoss.pst.BTree,​BTreeLeaf> context) throws IOException
      Construct 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

      public TableModel getNodeTableModel()
      Get a table model which can be used to describe this node.
      Specified by:
      getNodeTableModel in interface BTreeNode
      Returns:
      A DefaultTableModel describing this node.
    • rawData

      public ByteBuffer rawData​(io.github.jmcleodfoss.pst.BlockMap bbt, PSTFile pstFile) throws IOException
      Provide a mechanism to read the data from the node via a ByteBuffer.
      Specified by:
      rawData in interface BTreeNode
      Parameters:
      bbt - The PST file's block B-tree
      pstFile - 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

      public String 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

      public Object getChild​(Object parent, int index)
      Obtain the given child of this node.
      Specified by:
      getChild in interface TreeModel
      Parameters:
      parent - The parent node to return the child of.
      index - The number of the child to return.
      Returns:
      The requested child node of the given parent node.
    • getChildCount

      public int getChildCount​(Object parent)
      Get the number of children of this node.
      Specified by:
      getChildCount in interface TreeModel
      Parameters:
      parent - The parent node to return the number of child nodes for.
      Returns:
      The number of children of the given parent node.
    • getIndexOfChild

      public int getIndexOfChild​(Object parent, Object child)
      Get the index of this child node in the given node.
      Specified by:
      getIndexOfChild in interface TreeModel
      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

      public String getNodeText​(Object value)
      Obtain text suitable for display in a JTree node.
      Specified by:
      getNodeText in interface TreeCustomNodeText
      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

      public Object getRoot()
      Get the root of the tree.
      Specified by:
      getRoot in interface TreeModel
      Returns:
      The root of this B-tree.
    • isLeaf

      public boolean isLeaf​(Object node)
      Is the given node a leaf node?
      Specified by:
      isLeaf in interface TreeModel
      Parameters:
      node - The node to check for leafiness.
      Returns:
      true if node is a leaf node, false if it is an intermediate 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.
      Specified by:
      key in interface BTreeNode
      Returns:
      The key for this node. This is guaranteed to be the smallest key of all leaf nodes descended from this node.
    • outputString

      @Deprecated public void outputString​(PrintStream out, StringBuilder prefix)
      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.