FileDocCategorySizeDatePackage
DynArrayImpl.javaAPI DocJava SE 5 API3827Fri Aug 26 14:54:20 BST 2005com.sun.corba.se.impl.dynamicany

DynArrayImpl

public class DynArrayImpl extends DynAnyCollectionImpl implements DynArray

Fields Summary
Constructors Summary
private DynArrayImpl()

        this(null, (Any)null, false);
    
protected DynArrayImpl(com.sun.corba.se.spi.orb.ORB orb, org.omg.CORBA.Any any, boolean copyValue)

        super(orb, any, copyValue);
    
protected DynArrayImpl(com.sun.corba.se.spi.orb.ORB orb, org.omg.CORBA.TypeCode typeCode)

        super(orb, typeCode);
    
Methods Summary
protected voidcheckValue(java.lang.Object[] value)

        if (value == null || value.length != getBound()) {
            throw new InvalidValue();
        }
    
protected booleaninitializeComponentsFromAny()

        // This typeCode is of kind tk_array.
        TypeCode typeCode = any.type();
        int length = getBound();
        TypeCode contentType = getContentType();
        InputStream input;

        try {
            input = any.create_input_stream();
        } catch (BAD_OPERATION e) {
            return false;
        }

        components = new DynAny[length];
        anys = new Any[length];

        for (int i=0; i<length; i++) {
            // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
            // but only for primitive types
            anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
            try {
                // Creates the appropriate subtype without copying the Any
                components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
            } catch (InconsistentTypeCode itc) { // impossible
            }
        }
        return true;
    
protected booleaninitializeComponentsFromTypeCode()

        // This typeCode is of kind tk_array.
        TypeCode typeCode = any.type();
        int length = getBound();
        TypeCode contentType = getContentType();

        components = new DynAny[length];
        anys = new Any[length];

        for (int i=0; i<length; i++) {
            createDefaultComponentAt(i, contentType);
        }
        return true;