CodecFactoryImpl.javaAPI DocJava SE 5 API3098Fri Aug 26 14:54:22 BST


public final class CodecFactoryImpl extends LocalObject implements CodecFactory
CodecFactoryImpl is the implementation of the Codec Factory, as described in orbos/99-12-02.

Fields Summary
private ORB
private ORBUtilSystemException
private static final int
private Codec[]
Constructors Summary
public CodecFactoryImpl(ORB orb)
Creates a new CodecFactory implementation. Stores the ORB that created this factory, for later use by the Codec.

        this.orb = orb;
	wrapper = ORBUtilSystemException.get( 
	    CORBALogDomains.RPC_PROTOCOL ) ;

	// Precreate a codec for version 1.0 through 
	// done since Codecs are immutable in their current implementation.
	// This is an optimization that eliminates the overhead of creating
	// a new Codec each time create_codec is called.
	for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) {
	    codecs[minor] = new CDREncapsCodec( orb, 1, minor );
Methods Summary
public org.omg.IOP.Codeccreate_codec(org.omg.IOP.Encoding enc)
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).

UnknownEncoding Thrown if this factory cannot create a Codec of the given encoding.

        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;
private voidnullParam()
Called when an invalid null parameter was passed. Throws a BAD_PARAM with a minor code of 1

	throw wrapper.nullParam() ;