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


Java Vector.copyInto方法代码示例

本文整理汇总了Java中java.util.Vector.copyInto方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.copyInto方法的具体用法?Java Vector.copyInto怎么用?Java Vector.copyInto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.copyInto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TransferableObject

import java.util.Vector; //导入方法依赖的package包/类
public TransferableObject(Object data) throws Exception {
    Vector v = new Vector();
    imageFlavor = new DataFlavor("image/x-java-Image;class=java.awt.Image");
    imageFlavor.setHumanPresentableName("Java Image Flavor Object");

    if( data instanceof java.awt.Image )
        v.addElement(imageFlavor);

    dfs = new DataFlavor[v.size()];
    v.copyInto(dfs);

    for (int j = 0; j < dfs.length; j++)
        System.out.println(" in constructor flavor : " + dfs[j]);

    this.data = data;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:ImageTransferTest.java

示例2: splitZone

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Break up the zone at the given index into pieces
 * of an acceptable size.
 */
void splitZone(int index, int offs0, int offs1) {
    // divide the old zone into a new set of bins
    Element elem = getElement();
    Document doc = elem.getDocument();
    Vector<View> zones = new Vector<View>();
    int offs = offs0;
    do {
        offs0 = offs;
        offs = Math.min(getDesiredZoneEnd(offs0), offs1);
        zones.addElement(createZone(offs0, offs));
    } while (offs < offs1);
    View oldZone = getView(index);
    View[] newZones = new View[zones.size()];
    zones.copyInto(newZones);
    replace(index, 1, newZones);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:ZoneView.java

示例3: fetchPrimaryKeys

import java.util.Vector; //导入方法依赖的package包/类
private void fetchPrimaryKeys() {

        Vector temp = new Vector(20);

        try {
            if (cConn == null) {
                return;
            }

            if (dbmeta == null) {
                dbmeta = cConn.getMetaData();
            }

            ResultSet colList = dbmeta.getPrimaryKeys(null, null, tableName);

            while (colList.next()) {
                temp.addElement(colList.getString("COLUMN_NAME"));
            }

            colList.close();
        } catch (SQLException e) {
            ZaurusEditor.printStatus("SQL Exception: " + e.getMessage());
        }

        primaryKeys = new String[temp.size()];

        temp.copyInto(primaryKeys);

        pkColIndex = new int[primaryKeys.length];

        for (int i = 0; i < primaryKeys.length; i++) {
            pkColIndex[i] = this.getColIndex(primaryKeys[i]);
        }    // end of for (int i=0; i<primaryKeys.length; i++)
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:35,代码来源:ZaurusTableForm.java

示例4: mergeWith

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Return a new Method object that is a legal combination of
 * this method object and another one.
 *
 * This requires determining the exceptions declared by the
 * combined method, which must be (only) all of the exceptions
 * declared in both old Methods that may thrown in either of
 * them.
 */
private Method mergeWith(Method other) {
    if (!getName().equals(other.getName()) ||
        !getType().equals(other.getType()))
        {
            throw new Error("attempt to merge method \"" +
                            other.getNameAndDescriptor() + "\" with \"" +
                            getNameAndDescriptor());
        }

    Vector<ClassDeclaration> legalExceptions
        = new Vector<ClassDeclaration>();
    try {
        collectCompatibleExceptions(
                                    other.exceptions, exceptions, legalExceptions);
        collectCompatibleExceptions(
                                    exceptions, other.exceptions, legalExceptions);
    } catch (ClassNotFound e) {
        env.error(0, "class.not.found", e.name,
                  getClassDefinition().getName());
        return null;
    }

    Method merged = (Method) clone();
    merged.exceptions = new ClassDeclaration[legalExceptions.size()];
    legalExceptions.copyInto(merged.exceptions);

    return merged;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:RemoteClass.java

示例5: asn1Encode

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Encodes an KrbCredInfo object.
 * @return the byte array of encoded KrbCredInfo object.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 */
public byte[] asn1Encode() throws Asn1Exception, IOException {
    Vector<DerValue> v = new Vector<>();
    v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), key.asn1Encode()));
    if (pname != null) {
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), pname.getRealm().asn1Encode()));
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), pname.asn1Encode()));
    }
    if (flags != null)
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), flags.asn1Encode()));
    if (authtime != null)
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x04), authtime.asn1Encode()));
    if (starttime != null)
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x05), starttime.asn1Encode()));
    if (endtime != null)
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x06), endtime.asn1Encode()));
    if (renewTill != null)
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x07), renewTill.asn1Encode()));
    if (sname != null) {
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x08), sname.getRealm().asn1Encode()));
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x09), sname.asn1Encode()));
    }
    if (caddr != null)
        v.addElement(new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0A), caddr.asn1Encode()));
    DerValue der[] = new DerValue[v.size()];
    v.copyInto(der);
    DerOutputStream out = new DerOutputStream();
    out.putSequence(der);
    return out.toByteArray();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:KrbCredInfo.java

示例6: keys

import java.util.Vector; //导入方法依赖的package包/类
/** This may be deprecated in a future release.  
 * It is recommended to use next() instead 
 * @return array of keys in the table 
 * */
public LuaValue[] keys() {
	Vector l = new Vector();
	LuaValue k = LuaValue.NIL;
	while ( true ) {
		Varargs n = next(k);
		if ( (k = n.arg1()).isnil() )
			break;
		l.addElement( k );
	}
	LuaValue[] a = new LuaValue[l.size()];
	l.copyInto(a);
	return a;
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:18,代码来源:LuaTable.java

示例7: fetchColumns

import java.util.Vector; //导入方法依赖的package包/类
private void fetchColumns() {

        Vector temp     = new Vector(20);
        Vector tempType = new Vector(20);

        try {
            if (cConn == null) {
                return;
            }

            if (dbmeta == null) {
                dbmeta = cConn.getMetaData();
            }

            ResultSet colList = dbmeta.getColumns(null, null, tableName, "%");

            while (colList.next()) {
                temp.addElement(colList.getString("COLUMN_NAME"));
                tempType.addElement(new Short(colList.getShort("DATA_TYPE")));
            }

            colList.close();
        } catch (SQLException e) {
            ZaurusEditor.printStatus("SQL Exception: " + e.getMessage());
        }

        columns = new String[temp.size()];

        temp.copyInto(columns);

        columnTypes = new short[temp.size()];

        for (int i = 0; i < columnTypes.length; i++) {
            columnTypes[i] = ((Short) tempType.elementAt(i)).shortValue();
        }
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:ZaurusTableForm.java

示例8: buildRules

import java.util.Vector; //导入方法依赖的package包/类
private void buildRules(BufferedReader in) throws IOException {
  String read = null;
  Vector<TransformationRule> ruleList = new Vector<TransformationRule>();
  while ((read = in.readLine()) != null) {
    buildRule(realTrimmer(read), ruleList);
  }
  ruleArray = new TransformationRule[ruleList.size()];
  ruleList.copyInto(ruleArray);
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:10,代码来源:GenericTransformator.java

示例9: LastReq

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Constructs a LastReq object.
 * @param encoding a Der-encoded data.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 */

public LastReq(DerValue encoding) throws Asn1Exception, IOException {
    Vector<LastReqEntry> v= new Vector<>();
    if (encoding.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    while (encoding.getData().available() > 0) {
        v.addElement(new LastReqEntry(encoding.getData().getDerValue()));
    }
    if (v.size() > 0) {
        entry = new LastReqEntry[v.size()];
        v.copyInto(entry);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:LastReq.java

示例10: AuthorizationData

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Constructs a new <code>AuthorizationData,</code> instance.
 * @param der a single DER-encoded value.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 */
public AuthorizationData(DerValue der) throws Asn1Exception, IOException {
    Vector<AuthorizationDataEntry> v = new Vector<>();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    while (der.getData().available() > 0) {
        v.addElement(new AuthorizationDataEntry(der.getData().getDerValue()));
    }
    if (v.size() > 0) {
        entry = new AuthorizationDataEntry[v.size()];
        v.copyInto(entry);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:AuthorizationData.java

示例11: getMinimum

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Get the minimum of the two given PermissionCollection
 * <code>thisPc</code> and <code>thatPc</code>.
 *
 * @param thisPc the first given PermissionColloection
 * object.
 *
 * @param thatPc the second given PermissionCollection
 * object.
 */
private CryptoPermission[] getMinimum(PermissionCollection thisPc,
                                      PermissionCollection thatPc) {
    Vector<CryptoPermission> permVector = new Vector<>(2);

    Enumeration<Permission> thisPcPermissions = thisPc.elements();

    // For each CryptoPermission in
    // thisPc object, do the following:
    // 1) if this CryptoPermission is implied
    //     by thatPc, this CryptoPermission
    //     should be returned, and we can
    //     move on to check the next
    //     CryptoPermission in thisPc.
    // 2) otherwise, we should return
    //     all CryptoPermissions in thatPc
    //     which
    //     are implied by this CryptoPermission.
    //     Then we can move on to the
    //     next CryptoPermission in thisPc.
    while (thisPcPermissions.hasMoreElements()) {
        CryptoPermission thisCp =
            (CryptoPermission)thisPcPermissions.nextElement();

        Enumeration<Permission> thatPcPermissions = thatPc.elements();
        while (thatPcPermissions.hasMoreElements()) {
            CryptoPermission thatCp =
                (CryptoPermission)thatPcPermissions.nextElement();

            if (thatCp.implies(thisCp)) {
                permVector.addElement(thisCp);
                break;
            }
            if (thisCp.implies(thatCp)) {
                permVector.addElement(thatCp);
            }
        }
    }

    CryptoPermission[] ret = new CryptoPermission[permVector.size()];
    permVector.copyInto(ret);
    return ret;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:53,代码来源:CryptoPermissions.java

示例12: getConfigurations

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Returns all of the graphics
 * configurations associated with this graphics device.
 */
public GraphicsConfiguration[] getConfigurations() {
    if (configs==null) {
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            defaultConfig = getDefaultConfiguration();
            if (defaultConfig != null) {
                configs = new GraphicsConfiguration[1];
                configs[0] = defaultConfig;
                return configs.clone();
            }
        }

        int max = getMaxConfigs(screen);
        int defaultPixID = getDefaultPixID(screen);
        Vector v = new Vector( max );
        if (defaultPixID == 0) {
            // Workaround for failing GDI calls
            defaultConfig = Win32GraphicsConfig.getConfig(this,
                                                          defaultPixID);
            v.addElement(defaultConfig);
        }
        else {
            for (int i = 1; i <= max; i++) {
                if (isPixFmtSupported(i, screen)) {
                    if (i == defaultPixID) {
                        defaultConfig = Win32GraphicsConfig.getConfig(
                         this, i);
                        v.addElement(defaultConfig);
                    }
                    else {
                        v.addElement(Win32GraphicsConfig.getConfig(
                         this, i));
                    }
                }
            }
        }
        configs = new GraphicsConfiguration[v.size()];
        v.copyInto(configs);
    }
    return configs.clone();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:Win32GraphicsDevice.java

示例13: parseClassBody

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Parse the body of a class or interface declaration,
 * starting at the left brace.
 */
protected ClassDefinition parseClassBody(IdentifierToken nm, int mod,
                                         int ctx, String doc,
                                         Vector<IdentifierToken> ext, Vector<IdentifierToken> impl, long p
                                         ) throws SyntaxError, IOException {
    // Decide which is the super class
    IdentifierToken sup = null;
    if ((mod & M_INTERFACE) != 0) {
        if (impl.size() > 0) {
            env.error(impl.elementAt(0).getWhere(),
                      "intf.impl.intf");
        }
        impl = ext;
    } else {
        if (ext.size() > 0) {
            if (ext.size() > 1) {
                env.error(ext.elementAt(1).getWhere(),
                          "multiple.inherit");
            }
            sup = ext.elementAt(0);
        }
    }

    ClassDefinition oldClass = curClass;

    // Begin a new class
    IdentifierToken implids[] = new IdentifierToken[impl.size()];
    impl.copyInto(implids);
    ClassDefinition newClass =
        actions.beginClass(p, doc, mod, nm, sup, implids);

    // Parse fields
    expect(LBRACE);
    while ((token != EOF) && (token != RBRACE)) {
        try {
            curClass = newClass;
            parseField();
        } catch (SyntaxError e) {
            recoverField(newClass);
        } finally {
            curClass = oldClass;
        }
    }
    expect(RBRACE);

    // End the class
    actions.endClass(scanner.prevPos, newClass);
    return newClass;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:53,代码来源:Parser.java

示例14: getIDLModuleNames

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Return the IDL module nesting of the given Type.
 * For IDLEntity CompoundTypes (or their arrays) apply any user specified
 * -idlModule translation or, if none applicable, strip any package
 * prefix.
 * Add boxedIDL or boxedRMI modules if required.
 * @param t Given Type
 * @return Array containing the original module nesting.
 */
protected String[] getIDLModuleNames(Type t) {
    String[] modNames = t.getIDLModuleNames();      //default module name array
    CompoundType ct;
    if ( t.isCompound() ) {
        ct = (CompoundType)t;
        if ( !ct.isIDLEntity ) return modNames;     //normal (non-IDLEntity) case
        if ( "org.omg.CORBA.portable.IDLEntity"
             .equals( t.getQualifiedName() ) )
            return modNames;
    }
    else if ( t.isArray() ) {
        Type et = t.getElementType();
        if ( et.isCompound() ) {
            ct = (CompoundType)et;
            if ( !ct.isIDLEntity ) return modNames;   //normal (non-IDLEntity) case
            if ( "org.omg.CORBA.portable.IDLEntity"
                 .equals( t.getQualifiedName() ) )
                return modNames;
        }
        else return modNames;
    }
    else return modNames;              //no preprocessing needed for primitives

    //it's an IDLEntity or an array of...
    Vector mVec = new Vector();
    if ( !translateJavaPackage( ct,mVec ) )      //apply -idlModule translation
        stripJavaPackage( ct,mVec );             //..or strip prefixes (not both)

    if ( ct.isBoxed() ) {                            //add boxedIDL if required
        mVec.insertElementAt( "org",0 );
        mVec.insertElementAt( "omg",1 );
        mVec.insertElementAt( "boxedIDL",2 );
    }
    if ( t.isArray() ) {                             //add boxedRMI if required
        mVec.insertElementAt( "org",0 );
        mVec.insertElementAt( "omg",1 );
        mVec.insertElementAt( "boxedRMI",2 );
    }
    String[] outArr = new String[mVec.size()];
    mVec.copyInto( outArr );
    return outArr;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:52,代码来源:IDLGenerator.java

示例15: parseName

import java.util.Vector; //导入方法依赖的package包/类
private static String[] parseName(String name) {

        Vector<String> tempStrings = new Vector<>();
        String temp = name;
        int i = 0;
        int componentStart = 0;
        String component;

        while (i < temp.length()) {
            if (temp.charAt(i) == NAME_COMPONENT_SEPARATOR) {
                /*
                 * If this separator is escaped then don't treat it
                 * as a separator
                 */
                if (i > 0 && temp.charAt(i - 1) == '\\') {
                    temp = temp.substring(0, i - 1) +
                        temp.substring(i, temp.length());
                    continue;
                }
                else {
                    if (componentStart <= i) {
                        component = temp.substring(componentStart, i);
                        tempStrings.addElement(component);
                    }
                    componentStart = i + 1;
                }
            } else {
                if (temp.charAt(i) == NAME_REALM_SEPARATOR) {
                    /*
                     * If this separator is escaped then don't treat it
                     * as a separator
                     */
                    if (i > 0 && temp.charAt(i - 1) == '\\') {
                        temp = temp.substring(0, i - 1) +
                            temp.substring(i, temp.length());
                        continue;
                    } else {
                        if (componentStart < i) {
                            component = temp.substring(componentStart, i);
                            tempStrings.addElement(component);
                        }
                        componentStart = i + 1;
                        break;
                    }
                }
            }
            i++;
        }

        if (i == temp.length()) {
            component = temp.substring(componentStart, i);
            tempStrings.addElement(component);
        }

        String[] result = new String[tempStrings.size()];
        tempStrings.copyInto(result);
        return result;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:PrincipalName.java


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