Search in sources :

Example 1 with Transmogrifier

use of org.openexi.sax.Transmogrifier in project ddf by codice.

the class EXIEncoder method encode.

/**
     * Takes the incoming xmlStream and performs EXI-encoding on it into the exiStream.
     *
     * @param xmlStream Input of xml data
     * @param exiStream Output of exi-encoded data
     * @throws EXIOptionsException
     * @throws TransmogrifierException
     * @throws java.io.IOException
     */
public static void encode(InputStream xmlStream, OutputStream exiStream) throws EXIOptionsException, TransmogrifierException, IOException {
    Transmogrifier trans = new Transmogrifier();
    trans.setAlignmentType(AlignmentType.bitPacked);
    GrammarCache grammarCache = new GrammarCache(null, GrammarOptions.DEFAULT_OPTIONS);
    trans.setGrammarCache(grammarCache);
    trans.setOutputStream(exiStream);
    LOGGER.debug("Starting EXI encoding process.");
    trans.encode(new InputSource(xmlStream));
    LOGGER.debug("EXI encoding complete.");
}
Also used : InputSource(org.xml.sax.InputSource) Transmogrifier(org.openexi.sax.Transmogrifier) GrammarCache(org.openexi.proc.grammars.GrammarCache)

Aggregations

GrammarCache (org.openexi.proc.grammars.GrammarCache)1 Transmogrifier (org.openexi.sax.Transmogrifier)1 InputSource (org.xml.sax.InputSource)1