Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.ptree
Class PTreeWriter

    java.lang.Object
      com.saxonica.ptree.PTreeWriter

    public class PTreeWriter

extends Object

This class serializes a TinyTree to a binary file on disk, in a proprietary format designed for speed of loading back into a new TinyTree.

The format stored on disk is not dependent on the NamePool. Although it still uses name codes, it also contains a mapping of namecodes to the actual QNames.

The base URIs of nodes are not retained. Line numbers (if they were present in the original tree) are not retained.

Constructor Summary
`PTreeWriter(ProfessionalConfiguration config)`

Method Summary
`static void` | `copyToPTree(Source in, ParseOptions options, OutputStream out)` Static utility method for writing a Ptree
`static void` | `main(String[] args)` Command line interface for writing a Ptree
`void` | `setPTreeVersion(int version)` Set the PTree version to be written.
`void` | `setTextMangler(TextMangler mangler)` Set a callback object that will be used to mangle the content of attribute nodes and text nodes
`void` | `writeTree(TinyTree tree, DataOutputStream out)` Serialize a TinyTree in PTree format to a supplied output stream

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PTreeWriter

    public PTreeWriter(ProfessionalConfiguration config)

Method Detail

### setPTreeVersion

    public void setPTreeVersion(int version)

  Set the PTree version to be written.

  Parameters:
    `version` - the version to be written. Must be 0.

### setTextMangler

    public void setTextMangler(TextMangler mangler)

  Set a callback object that will be used to mangle the content of attribute nodes and text nodes

  Parameters:
    `mangler` - the object to perform the content mangling

### writeTree

    public void writeTree(TinyTree tree,
                          DataOutputStream out)
                   throws IOException

  Serialize a TinyTree in PTree format to a supplied output stream

  Parameters:
    `tree` - the tree to be serialized
    `out` - the output stream. Responsibility for closing this stream rests with the caller
  Throws:
    `IOException` - if any error occurs writing to the output stream.

### copyToPTree

    public static void copyToPTree(Source in,
                                   ParseOptions options,
                                   OutputStream out)
                            throws XPathException,
                                   IOException

  Static utility method for writing a Ptree

  Parameters:
    `in` - the Source representing the document to be written as a PTree
    `options` - the options to be used when processing the input source
    `out` - the OutputStream to which the PTree is written. The responsibility for closing this stream rests with the caller.
  Throws:
    `XPathException` - if any failure occurs processing the input
    `IOException` - if any failure occurs writing the output
  Since:
    9.3

### main

    public static void main(String[] args)
                     throws Exception

  Command line interface for writing a Ptree

  Parameters:
    `args` - [-strip] source.xml out.tree
  Throws:
    `Exception` - if the operation fails

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.