org.openexi.sax
Class EXIReader

java.lang.Object
  extended by org.openexi.sax.ReaderSupport
      extended by org.openexi.sax.EXIReader
All Implemented Interfaces:
org.xml.sax.Attributes, org.xml.sax.XMLReader

public final class EXIReader
extends ReaderSupport
implements org.xml.sax.XMLReader

EXIReader implements the SAX XMLReader to provide a convenient and familiar interface for decoding an EXI stream.


Constructor Summary
EXIReader()
           
 
Method Summary
 boolean getFeature(java.lang.String name)
          Get features for the SAX parser.
 java.lang.Object getProperty(java.lang.String name)
          Use to retrieve the name of the lexical handler, currently the only property recognized by this class.
 void setAlignmentType(AlignmentType alignmentType)
          Set the bit alignment style used to compile the EXI input stream.
 void setBlockSize(int blockSize)
          Set the size, in number of values, of the information that will be processed as a chunk of the entire EXI stream.
 void setDatatypeRepresentationMap(QName[] dtrm, int n_bindings)
          Set a datatype representation map.
 void setEXISchemaResolver(EXISchemaResolver schemaResolver)
          Set the EXISchemaResolver to retrieve the schema needed to decode the current EXI stream.
 void setFeature(java.lang.String name, boolean value)
          Set features for the SAX parser.
 void setFragment(boolean isFragment)
          Set to true if the EXI input stream is an XML fragment (a non-compliant XML document with multiple root elements).
 void setLexicalHandler(org.xml.sax.ext.LexicalHandler lexicalHandler)
          Set a SAX lexical handler to receive SAX lexical events.
 void setPreserveLexicalValues(boolean preserveLexicalValues)
          Set to true if the EXI input stream was compiled with the Preserve Lexical Values set to true.
 void setProperty(java.lang.String name, java.lang.Object value)
          This method wraps the friendlier setLexicalHandler method to provide syntax familiar to experienced SAX programmers.
 void setValueMaxLength(int valueMaxLength)
          Set the maximum length of a string that will be stored for reuse in the String Table.
 void setValuePartitionCapacity(int valuePartitionCapacity)
          Set the maximum number of values in the String Table.
 
Methods inherited from class org.openexi.sax.ReaderSupport
getContentHandler, setContentHandler, setGrammarCache
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.XMLReader
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, parse, parse, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler
 
Methods inherited from interface org.xml.sax.Attributes
getIndex, getIndex, getLength, getLocalName, getQName, getType, getType, getType, getURI, getValue, getValue, getValue
 

Constructor Detail

EXIReader

public EXIReader()
Method Detail

setProperty

public final void setProperty(java.lang.String name,
                              java.lang.Object value)
                       throws org.xml.sax.SAXNotRecognizedException
This method wraps the friendlier setLexicalHandler method to provide syntax familiar to experienced SAX programmers. The only property supported is:
http://xml.org/sax/properties/lexical-handler

Specified by:
setProperty in interface org.xml.sax.XMLReader
Parameters:
name - must equal "http://xml.org/sax/properties/lexical-handler"
value - an org.xml.sax.ext.LexicalHandler object
Throws:
org.xml.sax.SAXNotRecognizedException

getProperty

public final java.lang.Object getProperty(java.lang.String name)
                                   throws org.xml.sax.SAXNotRecognizedException
Use to retrieve the name of the lexical handler, currently the only property recognized by this class. Pass the String "http://xml.org/sax/properties/lexical-handler" as the name.

Specified by:
getProperty in interface org.xml.sax.XMLReader
Returns:
String name of the lexical handler
Throws:
org.xml.sax.SAXNotRecognizedException

setFeature

public final void setFeature(java.lang.String name,
                             boolean value)
                      throws org.xml.sax.SAXNotRecognizedException,
                             org.xml.sax.SAXNotSupportedException
Set features for the SAX parser. The only supported arguments are
 EXIReader.setFeature("http://xml.org/sax/features/namespaces", true);
and
 EXIReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);

Specified by:
setFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getFeature

public final boolean getFeature(java.lang.String name)
                         throws org.xml.sax.SAXNotRecognizedException
Get features for the SAX parser.

Specified by:
getFeature in interface org.xml.sax.XMLReader
Returns:
true if the feature is "http://xml.org/sax/features/namespaces" and false if the feature is "http://xml.org/sax/features/namespace-prefixes"
Throws:
org.xml.sax.SAXNotRecognizedException

setAlignmentType

public final void setAlignmentType(AlignmentType alignmentType)
                            throws org.openexi.proc.common.EXIOptionsException
Set the bit alignment style used to compile the EXI input stream.

Parameters:
alignmentType - AlignmentType
Throws:
org.openexi.proc.common.EXIOptionsException

setFragment

public final void setFragment(boolean isFragment)
Set to true if the EXI input stream is an XML fragment (a non-compliant XML document with multiple root elements).

Parameters:
isFragment - true if the EXI input stream is an XML fragment.

setPreserveLexicalValues

public final void setPreserveLexicalValues(boolean preserveLexicalValues)
                                    throws org.openexi.proc.common.EXIOptionsException
Set to true if the EXI input stream was compiled with the Preserve Lexical Values set to true. The original strings, rather than logical XML equivalents, are restored in the XML output stream.

Parameters:
preserveLexicalValues - set to true if the EXI input stream was compiled with Preserve Lexical Values set to true.
Throws:
org.openexi.proc.common.EXIOptionsException

setEXISchemaResolver

public final void setEXISchemaResolver(EXISchemaResolver schemaResolver)
Set the EXISchemaResolver to retrieve the schema needed to decode the current EXI stream.

Parameters:
schemaResolver - EXISchemaResolver

setDatatypeRepresentationMap

public final void setDatatypeRepresentationMap(QName[] dtrm,
                                               int n_bindings)
                                        throws org.openexi.proc.common.EXIOptionsException
Set a datatype representation map.

Parameters:
dtrm - a sequence of pairs of datatype qname and datatype representation qname
n_bindings - the number of qname pairs
Throws:
org.openexi.proc.common.EXIOptionsException

setBlockSize

public final void setBlockSize(int blockSize)
                        throws org.openexi.proc.common.EXIOptionsException
Set the size, in number of values, of the information that will be processed as a chunk of the entire EXI stream. Reducing the block size can improve performance for devices with limited dynamic memory. Default is 1,000,000 items (not 1MB, but 1,000,000 complete Attribute and Element values). Block size is only used when the EXI stream is encoded with EXI-compression.

Parameters:
blockSize - number of values in each processing block. Default is 1,000,000.
Throws:
org.openexi.proc.common.EXIOptionsException

setValueMaxLength

public final void setValueMaxLength(int valueMaxLength)
Set the maximum length of a string that will be stored for reuse in the String Table. By default, there is no maximum length. However, in data sets that have long, unique strings of information, you can improve performance by limiting the size to the length of strings that are more likely to appear more than once.

Parameters:
valueMaxLength - maximum length of entries in the String Table.

setValuePartitionCapacity

public final void setValuePartitionCapacity(int valuePartitionCapacity)
Set the maximum number of values in the String Table. By default, there is no limit. If the target device has limited dynamic memory, limiting the number of entries in the String Table can improve performance and reduce the likelihood that you will exceed memory capacity.

Parameters:
valuePartitionCapacity - maximum number of entries in the String Table

setLexicalHandler

public void setLexicalHandler(org.xml.sax.ext.LexicalHandler lexicalHandler)
Set a SAX lexical handler to receive SAX lexical events.

Parameters:
lexicalHandler - SAX lexical handler