|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectLazyTreeBuilder
public class LazyTreeBuilder
Creates and/or loads a disk-based representation of an XML tree. Once created, the persistent version can be quickly and incrementally loaded into memory.
To build a tree, call the begin(StructuredStore)
method to start the
process. Using the Receiver it returns, pass all the SAX events gathered
from parsing the document. Finally, finish(Receiver, boolean)
will
complete the process.
To load a tree that was built previously, use either load method:
load(StructuredStore)
or load(StructuredStore, LazyDocument)
.
Field Summary | |
---|---|
private Configuration |
config
Saxon configuration used for tree loading |
static String |
CURRENT_VERSION
File version stored in the persistent file. |
private NamePool |
namePool
Name pool used to map namecodes |
private ConsecutiveMap |
names
Mapping of names found to our internal name numbers |
private PipelineConfiguration |
pipe
Pipeline configuration |
static String |
REQUIRED_VERSION
Minimum version we can read. |
private TinyTree |
tree
The Saxon 'tiny' document, used to load the input tree |
Constructor Summary | |
---|---|
LazyTreeBuilder(Configuration config)
Default constructor -- sets up the configuration |
Method Summary | |
---|---|
void |
abort(Receiver inBuilder)
Like finish() above, but aborts the tree building process and removes the file. |
Receiver |
begin(StructuredStore treeStore)
Alternate way of constructing a lazy tree. |
private void |
checkSupport()
Checks that the tree doesn't use features we don't support. |
void |
finish(Receiver inBuilder,
boolean closeStore)
Completes writing out a disk-based file. |
int |
getNodeNum(Receiver inBuilder)
Retrieves the current node number in the build. |
NodeInfo |
load(StructuredStore treeStore)
Load a persistent document using the default loader. |
void |
load(StructuredStore treeStore,
LazyDocument emptyDoc)
Load a pre-existing persistent tree and load it into an empty in-memory document. |
void |
setNamePool(NamePool pool)
Establishes the name pool used to resolve namecodes |
private void |
writeAttrs(SubStoreWriter out)
Build and write out all the attributes in the tree. |
private void |
writeNames(SubStoreWriter out)
Build and write out the table of names referenced by the tree. |
private void |
writeNodes(SubStoreWriter out)
Build and write out all the nodes in the tree. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private TinyTree tree
private NamePool namePool
private ConsecutiveMap names
private Configuration config
private PipelineConfiguration pipe
public static final String CURRENT_VERSION
public static final String REQUIRED_VERSION
Constructor Detail |
---|
public LazyTreeBuilder(Configuration config)
Method Detail |
---|
public void setNamePool(NamePool pool)
public NodeInfo load(StructuredStore treeStore) throws FileNotFoundException, IOException
treeStore
- The store to load from
FileNotFoundException
IOException
public void load(StructuredStore treeStore, LazyDocument emptyDoc) throws FileNotFoundException, IOException
treeStore
- The store to load fromemptyDoc
- An empty document object to initialize
FileNotFoundException
IOException
public Receiver begin(StructuredStore treeStore) throws IOException
finish(Receiver, boolean)
.
IOException
public int getNodeNum(Receiver inBuilder)
inBuilder
- The builder gotten from begin()
public void finish(Receiver inBuilder, boolean closeStore) throws IOException
IOException
public void abort(Receiver inBuilder)
private void writeNames(SubStoreWriter out) throws IOException
out
- SubStore to write to.
IOException
private void writeNodes(SubStoreWriter out) throws IOException
out
- SubStore to write to.
IOException
private void writeAttrs(SubStoreWriter out) throws IOException
out
- SubStore to write to.
IOException
private void checkSupport() throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |