本文整理汇总了Java中com.siemens.ct.exi.grammars.Grammars类的典型用法代码示例。如果您正苦于以下问题:Java Grammars类的具体用法?Java Grammars怎么用?Java Grammars使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Grammars类属于com.siemens.ct.exi.grammars包,在下文中一共展示了Grammars类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeEXI
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
@Override
public synchronized byte[] encodeEXI(Object jaxbObject, String xsdSchemaPath) {
Grammars grammar = null;
if (xsdSchemaPath.equals(GlobalValues.SCHEMA_PATH_APP_PROTOCOL.toString()))
grammar = getGrammarAppProtocol();
else if (xsdSchemaPath.equals(GlobalValues.SCHEMA_PATH_MSG_DEF.toString()))
grammar = getGrammarMsgDef();
else if (xsdSchemaPath.equals(GlobalValues.SCHEMA_PATH_XMLDSIG.toString()))
grammar = getGrammarXMLDSig();
else {
getLogger().error("False schema path provided for encoding jaxbObject into EXI");
return null;
}
InputStream inStream = marshalToInputStream(jaxbObject);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos = ((ByteArrayOutputStream) encode(inStream, grammar));
if (isHexAndBase64MsgRepresentation())
showHexAndBase64RepresentationOfMessage(jaxbObject, baos.toByteArray());
return baos.toByteArray();
}
示例2: codeSchemaInformed
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
protected void codeSchemaInformed() throws Exception {
String exiLocation = getEXILocation(false);
// create default factory and EXI grammar for schema
EXIFactory exiFactory = DefaultEXIFactory.newInstance();
GrammarFactory grammarFactory = GrammarFactory.newInstance();
Grammars g = grammarFactory.createGrammars(xsdLocation);
exiFactory.setGrammars(g);
// encode
OutputStream exiOS = new FileOutputStream(exiLocation);
EXIResult exiResult = new EXIResult(exiFactory);
exiResult.setOutputStream(exiOS);
encode(exiResult.getHandler());
exiOS.close();
// decode
EXISource saxSource = new EXISource(exiFactory);
XMLReader xmlReader = saxSource.getXMLReader();
decode(xmlReader, exiLocation);
}
示例3: prepare_EXIFactory
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
public static EXIFactory prepare_EXIFactory(String schemaLocation, boolean strict, boolean include_header_opt, String schemaId) throws EXIException {
EXIFactory efactory = DefaultEXIFactory.newInstance();
if (strict){
FidelityOptions fo = FidelityOptions.createStrict();
efactory.setFidelityOptions(fo);
}
// always bitpacked
efactory.setCodingMode(CodingMode.BIT_PACKED);
GrammarFactory gf = GrammarFactory.newInstance();
Grammars g = gf.createGrammars(schemaLocation);
EncodingOptions eo = EncodingOptions.createDefault();
if (schemaId != null){
g.setSchemaId(schemaId);
eo.setOption(EncodingOptions.INCLUDE_SCHEMA_ID);
}
if (include_header_opt){
eo.setOption(EncodingOptions.INCLUDE_OPTIONS);
}
efactory.setEncodingOptions(eo);
efactory.setGrammars(g);
return efactory;
}
示例4: getGrammarAppProtocol
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private Grammars getGrammarAppProtocol() {
return grammarAppProtocol;
}
示例5: setGrammarAppProtocol
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private void setGrammarAppProtocol(Grammars grammarAppProtocol) {
this.grammarAppProtocol = grammarAppProtocol;
}
示例6: getGrammarMsgDef
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private Grammars getGrammarMsgDef() {
return grammarMsgDef;
}
示例7: setGrammarMsgDef
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private void setGrammarMsgDef(Grammars grammarMsgDef) {
this.grammarMsgDef = grammarMsgDef;
}
示例8: getGrammarXMLDSig
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
public Grammars getGrammarXMLDSig() {
return grammarXMLDSig;
}
示例9: setGrammarXMLDSig
import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
public void setGrammarXMLDSig(Grammars grammarXMLDSig) {
this.grammarXMLDSig = grammarXMLDSig;
}