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


Java JIArray.getArrayInstance方法代码示例

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


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

示例1: OnDataChange

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public void OnDataChange(int dwTransid, int hGroup, int hrMasterQuality, int hrMasterError, int dwCount,
        JIArray phClientItems, JIArray pvValues, JIArray pwQualities, JIArray pftTimeStamps, JIArray pErrors) throws JIException
{
    Logger.getLogger(OPCDataCallbackImpl.class.getName()).finest("OnDataChange, transid="+dwTransid);
    Integer[] clientHandles = (Integer[]) phClientItems.getArrayInstance();
    Object[] values = new Object[dwCount];
    Short[] qualities = (Short[]) pwQualities.getArrayInstance();
    Date[] timeStamps = new Date[dwCount];
    Integer[] errors = (Integer[]) pErrors.getArrayInstance();

    JIStruct[] fileTimeStructs = (JIStruct[]) pftTimeStamps.getArrayInstance();
    for (int i = 0; i < fileTimeStructs.length; i++)
        timeStamps[i] = new FileTime(fileTimeStructs[i]).getTime();

    JIVariant[] valueVariants = (JIVariant[]) pvValues.getArrayInstance();
    for (int i = 0; i < valueVariants.length; i++)
        values[i] = valueVariants[i].getObject();

    listener.dataChanged(dwTransid, hGroup, hrMasterQuality, hrMasterError, clientHandles, values, qualities, timeStamps, errors);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:21,代码来源:OPCDataCallbackImpl.java

示例2: OnReadComplete

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public void OnReadComplete(int dwTransid, int hGroup, int hrMasterQuality, int hrMasterError, int dwCount,
        JIArray phClientItems, JIArray pvValues, JIArray pwQualities, JIArray pftTimeStamps, JIArray pErrors) throws JIException
{
    Logger.getLogger(OPCDataCallbackImpl.class.getName()).finest("OnReadComplete, transid="+dwTransid);
    Integer[] clientHandles = (Integer[]) phClientItems.getArrayInstance();
    Object[] values = new Object[dwCount];
    Short[] qualities = (Short[]) pwQualities.getArrayInstance();
    Date[] timeStamps = new Date[dwCount];
    Integer[] errors = (Integer[]) pErrors.getArrayInstance();

    JIStruct[] fileTimeStructs = (JIStruct[]) pftTimeStamps.getArrayInstance();
    for (int i = 0; i < fileTimeStructs.length; i++)
        timeStamps[i] = new FileTime(fileTimeStructs[i]).getTime();

    JIVariant[] valueVariants = (JIVariant[]) pvValues.getArrayInstance();
    for (int i = 0; i < valueVariants.length; i++)
        values[i] = valueVariants[i].getObject();

    listener.readCompleted(dwTransid, hGroup, hrMasterQuality, hrMasterError, clientHandles, values, qualities, timeStamps, errors);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:21,代码来源:OPCDataCallbackImpl.java

示例3: dumpArray

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
static protected void dumpArray ( final String prefix, final JIArray array ) throws JIException
{
    System.out.println ( prefix + String.format ( "IsConformant: %s, IsVarying: %s", array.isConformant () ? "yes" : "no", array.isVarying () ? "yes" : "no" ) );
    System.out.println ( prefix + String.format ( "Dimensions: %d", array.getDimensions () ) );
    for ( int i = 0; i < array.getDimensions (); i++ )
    {
        System.out.println ( prefix + String.format ( "Dimension #%d: Upper Bound: %d", i, array.getUpperBounds ()[i] ) );
    }

    final Object o = array.getArrayInstance ();
    System.out.println ( prefix + "Array Instance: " + o.getClass () );
    final Object[] a = (Object[])o;
    System.out.println ( prefix + "Array Size: " + a.length );

    for ( final Object value : a )
    {
        dumpValue ( prefix + "\t", value );
    }
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:20,代码来源:VariantDumper.java

示例4: onEvent

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
/**
 * This method is provided by the client to handle notifications from the OPCEventSubscription for events. This method can be
 * called whether this is a refresh or standard event notification.
 * @param clientSubscription
 * 		The client handle for the subscription object sending the event notifications.
 * @param refresh
 * 		TRUE if this is a subscription refresh.
 * @param lastRefresh
 * 		TRUE if this is the last subscription refresh in response to a specific invocation of the IOPCEventSubscriptionMgt::Refresh method.
 * @param count
 * 		Number of event notifications. A value of zero indicates this is a keep-alive notification.
 * @param events
 * 		Array of event notifications
 * @return
 * 		An EMPTY() array.
 * @throws JIException
 */
public Object[] onEvent(final int clientSubscription,final int refresh,final int lastRefresh, int count, JIArray eventsArray) throws JIException{
	final JIStruct[] events;
	if(count==0) events=new JIStruct[0];
	else events=(JIStruct[])eventsArray.getArrayInstance();
	new Thread(new Runnable(){
		public void run() {
			EventNotificationListener[] l;
			synchronized (listeners) {
				l=(EventNotificationListener[])listeners.toArray(new EventNotificationListener[listeners.size()]);
			}
			for (int i = 0; i < l.length;i++)
			{
				l[i].onEvent(events);
			}
		}
	},"Opc event sink thread").start();
	return new Object[0];
}
 
开发者ID:howie,项目名称:jinterop,代码行数:36,代码来源:JIOPCEventSink.java

示例5: getTCharArray

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public void getTCharArray()
    throws JIException, InterruptedException, UnknownHostException {
    System.gc();
    JICallBuilder callObject = new JICallBuilder( true);
    callObject.setOpnum(6);
    Object results[];

    callObject.addOutParamAsObject(new JIArray(Byte.class, new int[]{50},1,false), JIFlags.FLAG_NULL);
    results = comObject.call(callObject);

    JIArray arrayOfResults = (JIArray)results[0];
    Byte[] arrayOfBytes = (Byte[]) arrayOfResults.getArrayInstance();
    int length = 50;
    for (int i = 0; i < length; i++) {
      System.out.println(arrayOfBytes[i].byteValue());
    }
}
 
开发者ID:howie,项目名称:jinterop,代码行数:18,代码来源:SampleTestServer.java

示例6: getConformantIntArray

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public void getConformantIntArray()
   throws JIException, InterruptedException, UnknownHostException {

JICallBuilder callObject = new JICallBuilder( true);
   callObject.setOpnum(8);
   Object results[];

   callObject.addOutParamAsType(Integer.class, JIFlags.FLAG_NULL);
   callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
   results = comObject.call(callObject);

   JIArray arrayOfResults = (JIArray)((JIPointer)results[1]).getReferent();
   Integer[] arrayOfIntegers = (Integer[]) arrayOfResults.getArrayInstance();
   int length = ((Integer)results[0]).intValue();
   for (int i = 0; i < length; i++) {
     System.out.println(arrayOfIntegers[i].intValue());
   }
 }
 
开发者ID:howie,项目名称:jinterop,代码行数:19,代码来源:SampleTestServer.java

示例7: getNextRow

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
/**
 * Returns next row data
 * returns null where there is no more row
 * use getNextRow to get next row
 * 
 * @return next row
 * @throws KettleException
 */
public Object[] getNextRow() throws KettleException {
	
	if(this.rowsCount==0) return null;
	
	this.rowProcessed++;
	if(this.rowProcessed>=this.rowsCount) return null;
	
	try {
		
        Object[] values = enumVARIANT.next(1);
        JIArray array = (JIArray)values[0];
        Object[] arrayObj = (Object[])array.getArrayInstance();
       
           IJIDispatch wbemObject_dispatch = (IJIDispatch) narrowObject(((JIVariant)arrayObj[0]).getObjectAsComObject());
           JIVariant variant2 = (JIVariant)(wbemObject_dispatch.callMethodA("GetObjectText_",new Object[]{new Integer(1)}))[0];               
         
           return  getRowData(variant2.getObjectAsString().getString());

	}catch(Exception e) {
		throw new KettleException(e);
	}
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:31,代码来源:WMIQuery.java

示例8: OnWriteComplete

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public void OnWriteComplete(int dwTransid, int hGroup, int hrMasterError, int dwCount,
        JIArray pClientHandles, JIArray pErrors)
{
    Logger.getLogger(OPCDataCallbackImpl.class.getName()).finest("OnWriteComplete, transid="+dwTransid);
    Integer[] clientHandles = (Integer[]) pClientHandles.getArrayInstance();
    Integer[] errors = (Integer[]) pErrors.getArrayInstance();
    listener.writeCompleted(dwTransid, hGroup, hrMasterError, clientHandles, errors);
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:9,代码来源:OPCDataCallbackImpl.java

示例9: getDerivation

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
/**
 * An array of strings that describe the class derivation hierarchy for the instance being referenced.
 * The first element in the array defines the parent class and the last element defines the dynasty class.
 * <p>This property is read-only.</p>
 *
 * @return An array of strings that describe the class derivation hierarchy for the instance being referenced.
 * @throws WMIException
 */
public List<String> getDerivation() throws WMIException {
    try {
        JIVariant derivation_ = dispatch.get("Derivation_");
        List<String> result = new ArrayList<String>();
        JIArray jiArray = derivation_.getObjectAsArray();
        JIVariant[] variants = (JIVariant[])jiArray.getArrayInstance();
        for(JIVariant v : variants) {
            result.add(v.getObjectAsString2());
        }
        return result;
    } catch (JIException e) {
        throw new WMIException(e);
    }
}
 
开发者ID:chenlichao-cn,项目名称:wmi4j,代码行数:23,代码来源:SWbemObject.java

示例10: OnDataChange

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public Object[] OnDataChange ( final int transactionId, final int serverGroupHandle, final int masterQuality, final int masterErrorCode, final int count, final JIArray clientHandles, final JIArray values, final JIArray qualities, final JIArray timestamps, final JIArray errors )
{
    final IOPCDataCallback callback = this.callback;
    if ( callback == null )
    {
        return new Object[] { org.openscada.opc.dcom.common.Constants.S_OK };
    }

    // get arrays for more readable code later ;-)
    final Integer[] errorCodes = (Integer[])errors.getArrayInstance ();
    final Integer[] itemHandles = (Integer[])clientHandles.getArrayInstance ();
    final Short[] qualitiesArray = (Short[])qualities.getArrayInstance ();
    final JIVariant[] valuesArray = (JIVariant[])values.getArrayInstance ();
    final JIStruct[] timestampArray = (JIStruct[])timestamps.getArrayInstance ();

    // create result data
    final KeyedResultSet<Integer, ValueData> result = new KeyedResultSet<Integer, ValueData> ();
    for ( int i = 0; i < count; i++ )
    {
        final ValueData vd = new ValueData ();
        vd.setQuality ( qualitiesArray[i] );
        vd.setTimestamp ( FILETIME.fromStruct ( timestampArray[i] ).asCalendar () );
        vd.setValue ( valuesArray[i] );
        result.add ( new KeyedResult<Integer, ValueData> ( itemHandles[i], vd, errorCodes[i] ) );
    }

    // fire event
    try
    {
        callback.dataChange ( transactionId, serverGroupHandle, masterQuality, masterErrorCode, result );
    }
    catch ( final Throwable e )
    {
        e.printStackTrace ();
    }

    // The client must always return S_OK
    return new Object[] { org.openscada.opc.dcom.common.Constants.S_OK };
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:40,代码来源:OPCDataCallback.java

示例11: OnReadComplete

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public synchronized Object[] OnReadComplete ( final int transactionId, final int serverGroupHandle, final int masterQuality, final int masterErrorCode, final int count, final JIArray clientHandles, final JIArray values, final JIArray qualities, final JIArray timestamps, final JIArray errors )
{
    if ( this.callback == null )
    {
        return new Object[] { org.openscada.opc.dcom.common.Constants.S_OK };
    }

    // get arrays for more readable code later ;-)
    final Integer[] errorCodes = (Integer[])errors.getArrayInstance ();
    final Integer[] itemHandles = (Integer[])clientHandles.getArrayInstance ();
    final Short[] qualitiesArray = (Short[])qualities.getArrayInstance ();
    final JIVariant[] valuesArray = (JIVariant[])values.getArrayInstance ();
    final JIStruct[] timestampArray = (JIStruct[])timestamps.getArrayInstance ();

    // create result data
    final KeyedResultSet<Integer, ValueData> result = new KeyedResultSet<Integer, ValueData> ();
    for ( int i = 0; i < count; i++ )
    {
        final ValueData vd = new ValueData ();
        vd.setQuality ( qualitiesArray[i] );
        vd.setTimestamp ( FILETIME.fromStruct ( timestampArray[i] ).asCalendar () );
        vd.setValue ( valuesArray[i] );
        result.add ( new KeyedResult<Integer, ValueData> ( itemHandles[i], vd, errorCodes[i] ) );
    }

    // fire event
    try
    {
        this.callback.readComplete ( transactionId, serverGroupHandle, masterQuality, masterErrorCode, result );
    }
    catch ( final Throwable e )
    {
        e.printStackTrace ();
    }

    // The client must always return S_OK
    return new Object[] { org.openscada.opc.dcom.common.Constants.S_OK };
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:39,代码来源:OPCDataCallback.java

示例12: OnWriteComplete

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public synchronized Object[] OnWriteComplete ( final int transactionId, final int serverGroupHandle, final int masterErrorCode, final int count, final JIArray clientHandles, final JIArray errors )
{
    if ( this.callback == null )
    {
        return new Object[] { org.openscada.opc.dcom.common.Constants.S_OK };
    }

    // get arrays for more readable code later ;-)
    final Integer[] errorCodes = (Integer[])errors.getArrayInstance ();
    final Integer[] itemHandles = (Integer[])clientHandles.getArrayInstance ();

    // create result data
    final ResultSet<Integer> result = new ResultSet<Integer> ();
    for ( int i = 0; i < count; i++ )
    {
        result.add ( new Result<Integer> ( itemHandles[i], errorCodes[i] ) );
    }

    // fire event
    try
    {
        this.callback.writeComplete ( transactionId, serverGroupHandle, masterErrorCode, result );
    }
    catch ( final Throwable e )
    {
        e.printStackTrace ();
    }

    // The client must always return S_OK
    return new Object[] { org.openscada.opc.dcom.common.Constants.S_OK };
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:32,代码来源:OPCDataCallback.java

示例13: queryAvailableLocaleIDs

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public Collection<Integer> queryAvailableLocaleIDs () throws JIException
{
    JICallBuilder callObject = new JICallBuilder ( true );
    callObject.setOpnum ( 2 );

    callObject.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL );
    callObject.addOutParamAsObject ( new JIPointer ( new JIArray ( Integer.class, null, 1, true ) ), JIFlags.FLAG_NULL );

    Object[] result = getCOMObject ().call ( callObject );

    JIArray resultArray = (JIArray) ( (JIPointer)result[1] ).getReferent ();
    Integer[] intArray = (Integer[])resultArray.getArrayInstance ();

    return Arrays.asList ( intArray );
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:16,代码来源:OPCCommon.java

示例14: ArrayDesc

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
ArrayDesc(JIStruct values)
{
	if (values == null)
	{
		typeDesc = null;
		cDims = -1;
		safeArrayBounds = null;
		return;
	}

	typeDesc = new TypeDesc((JIStruct)values.getMember(0));
	cDims = ((Short)values.getMember(1)).shortValue();
	JIArray arry = (JIArray)values.getMember(2);
	Object[] arry2 = (Object [])arry.getArrayInstance();

	if (arry2 != null)
	{
		safeArrayBounds = new SafeArrayBounds[arry2.length];
		for (int i = 0;i < arry2.length; i++)
		{
			safeArrayBounds[i] = new SafeArrayBounds((JIStruct)arry2[i]);
		}
	}
	else
	{
		safeArrayBounds = null;
	}
}
 
开发者ID:howie,项目名称:jinterop,代码行数:29,代码来源:ArrayDesc.java

示例15: pasteArrayToWorkSheet

import org.jinterop.dcom.core.JIArray; //导入方法依赖的package包/类
public void pasteArrayToWorkSheet() throws JIException
{
	int dispId = dispatchOfWorkSheet.getIDsOfNames("Range");
	JIVariant variant = new JIVariant(new JIString("A1:C3"));
	Object[] out = new Object[]{JIVariant.class};
	JIVariant[] outVal2 = dispatchOfWorkSheet.get(dispId, new Object[]{variant});
	IJIDispatch dispRange = (IJIDispatch)JIObjectFactory.narrowObject(outVal2[0].getObjectAsComObject());


      JIVariant[][] newValue = {
    	        { new JIVariant(new JIString("defe")), new JIVariant(false), new JIVariant((double)(98765.0 / 12345.0))},
    	        { new JIVariant(new Date()), new JIVariant((int)5454),new JIVariant((float)(22.0 / 7.0) )       },
    	        { new JIVariant(true), new JIVariant(new JIString("dffe")),new JIVariant(new Date())}
    	      };

     // implement safe array XxX dimension

	dispRange.put("Value2", new JIVariant(new JIArray(newValue)));

	try {
		Thread.sleep(10000);
	} catch (InterruptedException e) {
		e.printStackTrace();
	}

	JIVariant variant2 = dispRange.get("Value2");
	JIArray newValue2 = variant2.getObjectAsArray();
	newValue = (JIVariant[][])newValue2.getArrayInstance();
	for(int i = 0; i < newValue.length; i++){
        for(int j = 0; j < newValue[i].length; j++){
          System.out.print(newValue[i][j] + "\t");
        }
        System.out.println();
	}

	dispatchOfWorkBook.callMethod("close",new Object[]{Boolean.FALSE,JIVariant.OPTIONAL_PARAM(),JIVariant.OPTIONAL_PARAM()});
	dispatch.callMethod("Quit");
	JISession.destroySession(session);
}
 
开发者ID:howie,项目名称:jinterop,代码行数:40,代码来源:MSExcel2.java


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