本文整理汇总了Java中org.omg.IOP.Encoding类的典型用法代码示例。如果您正苦于以下问题:Java Encoding类的具体用法?Java Encoding怎么用?Java Encoding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Encoding类属于org.omg.IOP包,在下文中一共展示了Encoding类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create_codec
import org.omg.IOP.Encoding; //导入依赖的package包/类
/**
* Creates a codec of the given encoding. The only format recognized
* by this factory is ENCODING_CDR_ENCAPS, versions 1.0 through
* 1.(MAX_MINOR_VERSION_SUPPORTED).
*
* @exception UnknownEncoding Thrown if this factory cannot create a
* Codec of the given encoding.
*/
public Codec create_codec ( Encoding enc )
throws UnknownEncoding
{
if( enc == null ) nullParam();
Codec result = null;
// This is the only format we can currently create codecs for:
if( (enc.format == ENCODING_CDR_ENCAPS.value) &&
(enc.major_version == 1) )
{
if( (enc.minor_version >= 0) &&
(enc.minor_version <= MAX_MINOR_VERSION_SUPPORTED) )
{
result = codecs[enc.minor_version];
}
}
if( result == null ) {
throw new UnknownEncoding();
}
return result;
}
示例2: create_codec
import org.omg.IOP.Encoding; //导入依赖的package包/类
/**
* Creates the Codec for the given encoding.
*
* @param for_encoding the encoding for that the Codec must be created.
*
* @return the suitable Codec.
*
* @throws UnknownEncoding if the encoding is not a ENCODING_CDR_ENCAPS.
*/
public Codec create_codec(Encoding for_encoding) throws UnknownEncoding
{
if (for_encoding.format != ENCODING_CDR_ENCAPS.value)
throw new UnknownEncoding("Only ENCODING_CDR_ENCAPS is " +
"supported by this factory."
);
return new CdrEncapsCodecImpl(orb,
new Version(for_encoding.major_version, for_encoding.minor_version)
);
}
示例3: init_codec
import org.omg.IOP.Encoding; //导入依赖的package包/类
/**
* Gets the Codec reference from the ORB.
*/
private void init_codec() throws CannotProceed
{
try {
CodecFactory factory =
CodecFactoryHelper.narrow(orb.resolve_initial_references("CodecFactory"));
Encoding coding =
new Encoding(org.omg.IOP.ENCODING_CDR_ENCAPS.value,(byte)1,(byte)2);
codec = factory.create_codec(coding);
} catch (Throwable th) {
throw new CannotProceed(th.toString());
}
}