Package org.exbin.xbup.parser_tree
Class XBTreeNode
- java.lang.Object
- 
- org.exbin.xbup.parser_tree.XBTreeNode
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- javax.swing.tree.TreeNode,- org.exbin.xbup.core.block.XBBlock,- org.exbin.xbup.core.block.XBEditableBlock,- org.exbin.xbup.core.ubnumber.UBStreamable
 
 public class XBTreeNode extends java.lang.Object implements org.exbin.xbup.core.block.XBEditableBlock, javax.swing.tree.TreeNode, org.exbin.xbup.core.ubnumber.UBStreamableBasic object model parser XBUP level 0 document block / tree node.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description XBTreeNode()XBTreeNode(XBTreeNode parent)Creates a new instance of XBTreeNode with parent node assigned.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(org.exbin.xbup.core.parser.token.XBAttribute attribute)voidaddChild(XBTreeNode child)intattributesSizeUB()voidclear()voidclearData()XBTreeNodecloneNode(boolean recursive)XBTreeNodecreateNewChild(int childIndex)This method instantiates new child node.static XBTreeNodecreateTreeCopy(org.exbin.xbup.core.block.XBBlock block)Creates XBTreeNode copy of given block and all of its children.static XBTreeNodecreateTreeCopy(org.exbin.xbup.core.block.XBBlock block, XBTreeNode parent)Creates XBTreeNode copy of given block and all of its children.XBTreeNodefindNodeByIndex(long index)Finds node of given index (recursive, no cache).intfromStreamUB(java.io.InputStream stream)intfromStreamUB(java.io.InputStream stream, boolean terminable)Loads this node from data stream.booleangetAllowsChildren()org.exbin.xbup.core.parser.token.XBAttributegetAttributeAt(int index)org.exbin.xbup.core.parser.token.XBAttribute[]getAttributes()intgetAttributesCount()org.exbin.auxiliary.paged_data.BinaryDatagetBlockData()intgetBlockIndex()Gets index in depth-first order.longgetBlockSize()java.io.InputStreamgetData()org.exbin.xbup.core.block.XBBlockDataModegetDataMode()longgetDataSize()XBTreeNodegetChildAt(int childIndex)intgetChildCount()org.exbin.xbup.core.block.XBBlock[]getChildren()intgetChildrenCount()intgetIndex(javax.swing.tree.TreeNode node)Returns index of child.intgetNodeIndexAfter()XBTreeNodegetParent()java.util.Optional<org.exbin.xbup.core.block.XBBlock>getParentBlock()intgetSizeUB()intgetSubNodesCount()Gets count of all subnodes.org.exbin.xbup.core.block.XBBlockTerminationModegetTerminationMode()java.util.Enumerationchildren()intchildrenFromStreamUB(java.io.InputStream stream, java.lang.Integer maxSize)Loads children from data stream.intchildrenSizeUB()intchildrenToStreamUB(java.io.OutputStream stream)booleanisLeaf()voidremoveAttribute(int index)voidremoveChild(int index)voidsetAttributeAt(org.exbin.xbup.core.parser.token.XBAttribute attribute, int attributeIndex)voidsetAttributes(org.exbin.xbup.core.parser.token.XBAttribute[] attributes)voidsetAttributesCount(int count)voidsetData(java.io.InputStream source)voidsetData(org.exbin.auxiliary.paged_data.BinaryData newData)voidsetDataMode(org.exbin.xbup.core.block.XBBlockDataMode dataMode)voidsetChildAt(org.exbin.xbup.core.block.XBBlock block, int childIndex)voidsetChildren(org.exbin.xbup.core.block.XBBlock[] children)voidsetChildrenCount(int count)voidsetParent(org.exbin.xbup.core.block.XBBlock parent)voidsetTerminationMode(org.exbin.xbup.core.block.XBBlockTerminationMode terminationMode)inttoStreamUB(java.io.OutputStream stream)
 
- 
- 
- 
Constructor Detail- 
XBTreeNodepublic XBTreeNode() 
 - 
XBTreeNodepublic XBTreeNode(XBTreeNode parent) Creates a new instance of XBTreeNode with parent node assigned. This is NOT copy constructor.- Parameters:
- parent- Set it as parent node
 
 
- 
 - 
Method Detail- 
getSubNodesCountpublic int getSubNodesCount() Gets count of all subnodes.- Returns:
- count of child nodes and all their child nodes
 
 - 
getBlockIndexpublic int getBlockIndex() Gets index in depth-first order.- Returns:
- node index
 
 - 
getNodeIndexAfterpublic int getNodeIndexAfter() 
 - 
findNodeByIndexpublic XBTreeNode findNodeByIndex(long index) Finds node of given index (recursive, no cache).- Parameters:
- index- depth-first order index
- Returns:
- node if found
 
 - 
fromStreamUBpublic int fromStreamUB(java.io.InputStream stream) throws java.io.IOException, org.exbin.xbup.core.parser.XBProcessingException- Specified by:
- fromStreamUBin interface- org.exbin.xbup.core.ubnumber.UBStreamable
- Throws:
- java.io.IOException
- org.exbin.xbup.core.parser.XBProcessingException
 
 - 
fromStreamUBpublic int fromStreamUB(java.io.InputStream stream, boolean terminable) throws java.io.IOException, org.exbin.xbup.core.parser.XBProcessingExceptionLoads this node from data stream.- Parameters:
- stream- data stream
- terminable- specify if terminator can be read
- Returns:
- size of read bytes
- Throws:
- java.io.IOException- exception on input/output error
- org.exbin.xbup.core.parser.XBProcessingException
 
 - 
childrenFromStreamUBpublic int childrenFromStreamUB(java.io.InputStream stream, java.lang.Integer maxSize) throws java.io.IOException, org.exbin.xbup.core.parser.XBProcessingExceptionLoads children from data stream.- Parameters:
- stream- input stream
- maxSize- Maximum size of bytes to consume. Otherwise Exception. Zero means terminationMode block.
- Returns:
- size of bytes read
- Throws:
- java.io.IOException- exception on input/output error
- org.exbin.xbup.core.parser.XBProcessingException
 
 - 
toStreamUBpublic int toStreamUB(java.io.OutputStream stream) throws java.io.IOException- Specified by:
- toStreamUBin interface- org.exbin.xbup.core.ubnumber.UBStreamable
- Throws:
- java.io.IOException
 
 - 
childrenToStreamUBpublic int childrenToStreamUB(java.io.OutputStream stream) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
getSizeUBpublic int getSizeUB() - Specified by:
- getSizeUBin interface- org.exbin.xbup.core.ubnumber.UBStreamable
 
 - 
getAllowsChildrenpublic boolean getAllowsChildren() - Specified by:
- getAllowsChildrenin interface- javax.swing.tree.TreeNode
 
 - 
isLeafpublic boolean isLeaf() - Specified by:
- isLeafin interface- javax.swing.tree.TreeNode
 
 - 
childrenpublic java.util.Enumeration children() - Specified by:
- childrenin interface- javax.swing.tree.TreeNode
 
 - 
clearpublic void clear() - Specified by:
- clearin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
childrenSizeUBpublic int childrenSizeUB() 
 - 
attributesSizeUBpublic int attributesSizeUB() 
 - 
getDatapublic java.io.InputStream getData() - Specified by:
- getDatain interface- org.exbin.xbup.core.block.XBBlock
 
 - 
getBlockDatapublic org.exbin.auxiliary.paged_data.BinaryData getBlockData() - Specified by:
- getBlockDatain interface- org.exbin.xbup.core.block.XBBlock
 
 - 
getDataSizepublic long getDataSize() 
 - 
setDatapublic void setData(java.io.InputStream source) throws java.io.IOException- Specified by:
- setDatain interface- org.exbin.xbup.core.block.XBEditableBlock
- Throws:
- java.io.IOException
 
 - 
setDatapublic void setData(org.exbin.auxiliary.paged_data.BinaryData newData) - Specified by:
- setDatain interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
clearDatapublic void clearData() 
 - 
cloneNodepublic XBTreeNode cloneNode(boolean recursive) 
 - 
createNewChildpublic XBTreeNode createNewChild(int childIndex) This method instantiates new child node.- Specified by:
- createNewChildin interface- org.exbin.xbup.core.block.XBEditableBlock
- Parameters:
- childIndex- child index
- Returns:
- new
 
 - 
getBlockSizepublic long getBlockSize() 
 - 
getParent@Nullable public XBTreeNode getParent() - Specified by:
- getParentin interface- javax.swing.tree.TreeNode
 
 - 
getParentBlock@Nonnull public java.util.Optional<org.exbin.xbup.core.block.XBBlock> getParentBlock() - Specified by:
- getParentBlockin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setParentpublic void setParent(org.exbin.xbup.core.block.XBBlock parent) - Specified by:
- setParentin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getTerminationModepublic org.exbin.xbup.core.block.XBBlockTerminationMode getTerminationMode() - Specified by:
- getTerminationModein interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setTerminationModepublic void setTerminationMode(org.exbin.xbup.core.block.XBBlockTerminationMode terminationMode) - Specified by:
- setTerminationModein interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getDataModepublic org.exbin.xbup.core.block.XBBlockDataMode getDataMode() - Specified by:
- getDataModein interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setDataModepublic void setDataMode(org.exbin.xbup.core.block.XBBlockDataMode dataMode) - Specified by:
- setDataModein interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getAttributeAtpublic org.exbin.xbup.core.parser.token.XBAttribute getAttributeAt(int index) - Specified by:
- getAttributeAtin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setAttributeAtpublic void setAttributeAt(org.exbin.xbup.core.parser.token.XBAttribute attribute, int attributeIndex)- Specified by:
- setAttributeAtin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getAttributesCountpublic int getAttributesCount() - Specified by:
- getAttributesCountin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setAttributesCountpublic void setAttributesCount(int count) - Specified by:
- setAttributesCountin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
addAttributepublic void addAttribute(org.exbin.xbup.core.parser.token.XBAttribute attribute) 
 - 
removeAttributepublic void removeAttribute(int index) - Specified by:
- removeAttributein interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getAttributespublic org.exbin.xbup.core.parser.token.XBAttribute[] getAttributes() - Specified by:
- getAttributesin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setAttributespublic void setAttributes(org.exbin.xbup.core.parser.token.XBAttribute[] attributes) - Specified by:
- setAttributesin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getChildAtpublic XBTreeNode getChildAt(int childIndex) - Specified by:
- getChildAtin interface- javax.swing.tree.TreeNode
- Specified by:
- getChildAtin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setChildAtpublic void setChildAt(org.exbin.xbup.core.block.XBBlock block, int childIndex)- Specified by:
- setChildAtin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getIndexpublic int getIndex(javax.swing.tree.TreeNode node) Returns index of child.- Specified by:
- getIndexin interface- javax.swing.tree.TreeNode
- Parameters:
- node- node to search match for
- Returns:
- index of node if node found
 
 - 
addChildpublic void addChild(XBTreeNode child) 
 - 
removeChildpublic void removeChild(int index) - Specified by:
- removeChildin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getChildrenCountpublic int getChildrenCount() - Specified by:
- getChildrenCountin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
getChildCountpublic int getChildCount() - Specified by:
- getChildCountin interface- javax.swing.tree.TreeNode
 
 - 
setChildrenCountpublic void setChildrenCount(int count) - Specified by:
- setChildrenCountin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
getChildrenpublic org.exbin.xbup.core.block.XBBlock[] getChildren() - Specified by:
- getChildrenin interface- org.exbin.xbup.core.block.XBBlock
 
 - 
setChildrenpublic void setChildren(org.exbin.xbup.core.block.XBBlock[] children) - Specified by:
- setChildrenin interface- org.exbin.xbup.core.block.XBEditableBlock
 
 - 
createTreeCopypublic static XBTreeNode createTreeCopy(org.exbin.xbup.core.block.XBBlock block) Creates XBTreeNode copy of given block and all of its children.- Parameters:
- block- source block
- Returns:
- node
 
 - 
createTreeCopypublic static XBTreeNode createTreeCopy(org.exbin.xbup.core.block.XBBlock block, XBTreeNode parent) Creates XBTreeNode copy of given block and all of its children.- Parameters:
- block- source block
- parent- parent node
- Returns:
- node
 
 
- 
 
-