org.exist.storage.store
Class DOMFileIterator

java.lang.Object
  extended byorg.exist.storage.store.DOMFileIterator
All Implemented Interfaces:
java.util.Iterator

public final class DOMFileIterator
extends java.lang.Object
implements java.util.Iterator

Class DOMFileIterator is used to iterate over nodes in the DOM storage. This implementation returns the raw value of the node. You have to call Node.deserialize() to read the node from the value data. The DOM file is locked to locate the data and released afterwards. Before working with the returned data, you should get a copy by calling value.getData().

Author:
wolf

Constructor Summary
DOMFileIterator(java.lang.Object lock, DOMFile db, long address)
          Constructor for the DOMFileIterator object
DOMFileIterator(java.lang.Object lock, DOMFile db, NodeProxy node)
          Constructor for the DOMFileIterator object
 
Method Summary
 long currentAddress()
          Returns the internal virtual address of the node at the iterator's current position.
 boolean hasNext()
          Are there more nodes to be read?
 java.lang.Object next()
          Returns the raw data of the next node in the sequence.
 void remove()
          Remove the current node.
 void setTo(long address)
          Reposition the iterate at a given address.
 void setTo(NodeProxy node)
          Reposition the iterator at the address of the proxy node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMFileIterator

public DOMFileIterator(java.lang.Object lock,
                       DOMFile db,
                       NodeProxy node)
                throws org.dbxml.core.filer.BTreeException,
                       java.io.IOException
Constructor for the DOMFileIterator object

Parameters:
db - Description of the Parameter
node - Description of the Parameter
Throws:
org.dbxml.core.filer.BTreeException - Description of the Exception
java.io.IOException - Description of the Exception

DOMFileIterator

public DOMFileIterator(java.lang.Object lock,
                       DOMFile db,
                       long address)
                throws org.dbxml.core.filer.BTreeException,
                       java.io.IOException
Constructor for the DOMFileIterator object

Parameters:
db - Description of the Parameter
address - Description of the Parameter
Throws:
org.dbxml.core.filer.BTreeException - Description of the Exception
java.io.IOException - Description of the Exception
Method Detail

currentAddress

public long currentAddress()
Returns the internal virtual address of the node at the iterator's current position.

Returns:
The currentAddress value

hasNext

public boolean hasNext()
Are there more nodes to be read?

Specified by:
hasNext in interface java.util.Iterator
Returns:
Description of the Return Value

next

public java.lang.Object next()
Returns the raw data of the next node in the sequence.

Specified by:
next in interface java.util.Iterator
Returns:
Description of the Return Value

remove

public void remove()
Remove the current node. This implementation just decrements the node count. It does not actually remove the node's value, but removes a page if node count == 0. Use this method only if you want to delete an entire document, not to remove a single node.

Specified by:
remove in interface java.util.Iterator

setTo

public void setTo(NodeProxy node)
Reposition the iterator at the address of the proxy node.

Parameters:
node - The new to value

setTo

public void setTo(long address)
Reposition the iterate at a given address.

Parameters:
address - The new to value


Copyright (C) Wolfgang Meier. All rights reserved.