当前位置: 首页>>代码示例>>Java>>正文


Java Grammars类代码示例

本文整理汇总了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();
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:25,代码来源:EXIficientCodec.java

示例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);
}
 
开发者ID:EXIficient,项目名称:exificient,代码行数:22,代码来源:EXIficientDemo.java

示例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;
   }
 
开发者ID:akari-h,项目名称:nex,代码行数:25,代码来源:EXIUtil.java

示例4: getGrammarAppProtocol

import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private Grammars getGrammarAppProtocol() {
	return grammarAppProtocol;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:4,代码来源:EXIficientCodec.java

示例5: setGrammarAppProtocol

import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private void setGrammarAppProtocol(Grammars grammarAppProtocol) {
	this.grammarAppProtocol = grammarAppProtocol;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:4,代码来源:EXIficientCodec.java

示例6: getGrammarMsgDef

import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private Grammars getGrammarMsgDef() {
	return grammarMsgDef;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:4,代码来源:EXIficientCodec.java

示例7: setGrammarMsgDef

import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
private void setGrammarMsgDef(Grammars grammarMsgDef) {
	this.grammarMsgDef = grammarMsgDef;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:4,代码来源:EXIficientCodec.java

示例8: getGrammarXMLDSig

import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
public Grammars getGrammarXMLDSig() {
	return grammarXMLDSig;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:4,代码来源:EXIficientCodec.java

示例9: setGrammarXMLDSig

import com.siemens.ct.exi.grammars.Grammars; //导入依赖的package包/类
public void setGrammarXMLDSig(Grammars grammarXMLDSig) {
	this.grammarXMLDSig = grammarXMLDSig;
}
 
开发者ID:V2GClarity,项目名称:RISE-V2G,代码行数:4,代码来源:EXIficientCodec.java


注:本文中的com.siemens.ct.exi.grammars.Grammars类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。