org.basex.data
Class Serialize

java.lang.Object
  extended by org.basex.data.Serialize

public final class Serialize
extends java.lang.Object

This class provides serialization methods for the database contents.

Author:
Workgroup DBIS, University of Konstanz 2005-07, ISC License, Christian Gruen

Method Summary
static byte[] content(Data data, int p, boolean s)
          Convenience method, returning a string representation of the current node.
static void decl(PrintOutput out)
          Prints the text declaration to the output stream.
static java.lang.String node(Data data, int p)
          Convenience method, returning a string representation of the current node.
static void table(PrintOutput out, Data data, int s, int e)
          Writes the database as table.
static void table(PrintOutput out, Data data, Nodes nodes)
          Writes the database as table.
static void xml(PrintOutput out, byte[] pref, byte[] val, byte[] suff)
          Writes a node.
static int xml(PrintOutput out, Data data, int pos)
          Writes the specified XML node and all its sub nodes to the specified output stream.
static int xml(PrintOutput out, Data data, int pre, boolean val, boolean ent)
          Prints the specified node to the output stream.
static void xml(PrintOutput out, Data data, Nodes nodes, boolean valid)
          Prints the specified node set to the output stream.
static void xml(ResultReader rr, Data data, int pos)
          Writes the specified XML node and all its sub nodes to the specified output stream.
static void xml(ResultReader rr, Data data, Nodes nodes)
          Prints the specified node set to the output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

content

public static byte[] content(Data data,
                             int p,
                             boolean s)
Convenience method, returning a string representation of the current node.

Parameters:
data - data reference
p - pre value
s - short representation
Returns:
string representation

decl

public static void decl(PrintOutput out)
                 throws java.io.IOException
Prints the text declaration to the output stream.

Parameters:
out - output stream
Throws:
java.io.IOException - in case of problems with the PrintOutput

node

public static java.lang.String node(Data data,
                                    int p)
Convenience method, returning a string representation of the current node.

Parameters:
data - data reference
p - pre value
Returns:
string representation

table

public static void table(PrintOutput out,
                         Data data,
                         int s,
                         int e)
                  throws java.io.IOException
Writes the database as table.

Parameters:
out - output stream
data - data reference
s - first node to be written
e - last node to be written
Throws:
java.io.IOException - build or write error

table

public static void table(PrintOutput out,
                         Data data,
                         Nodes nodes)
                  throws java.io.IOException
Writes the database as table.

Parameters:
out - output stream
data - data reference
nodes - node set
Throws:
java.io.IOException - build or write error

xml

public static void xml(PrintOutput out,
                       byte[] pref,
                       byte[] val,
                       byte[] suff)
                throws java.io.IOException
Writes a node.

Parameters:
out - output stream
pref - prefix
suff - suffix
val - value to be written
Throws:
java.io.IOException - in case of problems with the PrintOutput

xml

public static int xml(PrintOutput out,
                      Data data,
                      int pos)
               throws java.io.IOException
Writes the specified XML node and all its sub nodes to the specified output stream.

Parameters:
out - writer instance
data - data reference
pos - XML node to be written
Returns:
last p value
Throws:
java.io.IOException - in case of problems with the PrintOutput

xml

public static int xml(PrintOutput out,
                      Data data,
                      int pre,
                      boolean val,
                      boolean ent)
               throws java.io.IOException
Prints the specified node to the output stream.

Parameters:
out - output stream
data - data reference
val - valid flag
pre - table position
ent - dissolve entities
Returns:
last p value
Throws:
java.io.IOException - in case of problems with the PrintOutput

xml

public static void xml(PrintOutput out,
                       Data data,
                       Nodes nodes,
                       boolean valid)
                throws java.io.IOException
Prints the specified node set to the output stream.

Parameters:
out - output stream
data - data reference
valid - valid flag
nodes - node set
Throws:
java.io.IOException - in case of problems with the PrintOutput

xml

public static void xml(ResultReader rr,
                       Data data,
                       int pos)
                throws org.xml.sax.SAXException
Writes the specified XML node and all its sub nodes to the specified output stream.

Parameters:
rr - default handler
data - data reference
pos - XML node to be written
Throws:
org.xml.sax.SAXException - SAX exception

xml

public static void xml(ResultReader rr,
                       Data data,
                       Nodes nodes)
                throws org.xml.sax.SAXException
Prints the specified node set to the output stream.

Parameters:
rr - default handler
data - data reference
nodes - node set
Throws:
org.xml.sax.SAXException - SAX exception