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


Java JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR属性代码示例

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


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

示例1: getItemHandles

public ResultTable<Integer, Integer> getItemHandles(String[] itemIDs, Integer[] clientHandles) throws JIException {
    if (itemIDs.length != clientHandles.length) {
        throw new IllegalArgumentException("Arrays' sizes differ.");
    }
    JIString[] array = new JIString[itemIDs.length];
    for (int i = 0; i < array.length; i++) {
        array[i] = new JIString(itemIDs[i], JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
    }
    JICallBuilder callObject = new JICallBuilder(true);
    callObject.setOpnum(3);
    callObject.addInParamAsInt(itemIDs.length, JIFlags.FLAG_NULL);
    callObject.addInParamAsArray(new JIArray(array, true), JIFlags.FLAG_NULL);
    callObject.addInParamAsArray(new JIArray(clientHandles, true), JIFlags.FLAG_NULL);
    callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
    callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);

    Object[] result;
    try {
        result = comObject.call(callObject);
    } catch (JIException ex) {
        if (ex.getErrorCode() == 1 /*S_FALSE*/) {
            result = callObject.getResultsInCaseOfException();
        } else {
            throw ex;
        }
    }
    Integer[] serverHandles = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
    Integer[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[1]).getReferent()).getArrayInstance();
    ResultTable<Integer, Integer> resultTable = new ResultTable<>();
    for (int i = 0; i < clientHandles.length; i++) {
        resultTable.put(clientHandles[i], serverHandles[i], errorCodes[i]);
    }
    return resultTable;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:34,代码来源:IOPCHDA_Server.java

示例2: read

public void read ( final IORequest[] requests ) throws JIException
{
    if ( requests.length == 0 )
    {
        return;
    }

    JICallBuilder callObject = new JICallBuilder ( true );
    callObject.setOpnum ( 0 );

    JIString itemIDs[] = new JIString[requests.length];
    Integer maxAges[] = new Integer[requests.length];
    for ( int i = 0; i < requests.length; i++ )
    {
        itemIDs[i] = new JIString ( requests[i].getItemID (), JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR );
        maxAges[i] = new Integer ( requests[i].getMaxAge () );
    }

    callObject.addInParamAsInt ( requests.length, JIFlags.FLAG_NULL );
    callObject.addInParamAsArray ( new JIArray ( itemIDs, true ), JIFlags.FLAG_NULL );
    callObject.addInParamAsArray ( new JIArray ( maxAges, true ), JIFlags.FLAG_NULL );

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

    getCOMObject ().call ( callObject );
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:29,代码来源:OPCItemIO.java

示例3: dumpValue

static protected void dumpValue ( final String prefix, final Object value ) throws JIException
{
    if ( value instanceof JIVariant )
    {
        System.out.println ( prefix + "JIVariant" );
        final JIVariant variant = (JIVariant)value;
        System.out.println ( prefix + String.format ( "IsArray: %s, IsByRef: %s, IsNull: %s", variant.isArray () ? "yes" : "no", variant.isByRefFlagSet () ? "yes" : "no", variant.isNull () ? "yes" : "no" ) );

        if ( variant.isArray () )
        {
            dumpArray ( prefix, variant.getObjectAsArray () );
        }
        else
        {
            dumpValue ( prefix + "\t", variant.getObject () );
        }
    }
    else if ( value instanceof JIString )
    {
        final JIString string = (JIString)value;

        String strType;
        switch ( string.getType () )
        {
        case JIFlags.FLAG_REPRESENTATION_STRING_BSTR:
            strType = "BSTR";
            break;
        case JIFlags.FLAG_REPRESENTATION_STRING_LPCTSTR:
            strType = "LPCSTR";
            break;
        case JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR:
            strType = "LPWSTR";
            break;
        default:
            strType = "unknown";
            break;
        }
        System.out.println ( prefix + String.format ( "JIString: '%s' (%s)", string.getString (), strType ) );
    }
    else if ( value instanceof Double )
    {
        System.out.println ( prefix + "Double: " + value );
    }
    else if ( value instanceof Float )
    {
        System.out.println ( prefix + "Float: " + value );
    }
    else if ( value instanceof Byte )
    {
        System.out.println ( prefix + "Byte: " + value );
    }
    else if ( value instanceof Character )
    {
        System.out.println ( prefix + "Character: " + value );
    }
    else if ( value instanceof Integer )
    {
        System.out.println ( prefix + "Integer: " + value );
    }
    else if ( value instanceof Short )
    {
        System.out.println ( prefix + "Short: " + value );
    }
    else if ( value instanceof Long )
    {
        System.out.println ( prefix + "Long: " + value );
    }
    else if ( value instanceof Boolean )
    {
        System.out.println ( prefix + "Boolean: " + value );
    }

    else
    {
        System.out.println ( prefix + String.format ( "Unknown value type (%s): %s", value.getClass (), value.toString () ) );
    }
}
 
开发者ID:luoyan35714,项目名称:OPC_Client,代码行数:77,代码来源:VariantDumper.java

示例4: getIDsOfNames

public int getIDsOfNames(String apiName) throws JIException
{
	if (apiName == null || apiName.trim().equals(""))
	{
		throw new IllegalArgumentException(JISystem.getLocalizedMessage(JIErrorCodes.JI_DISP_INCORRECT_VALUE_FOR_GETIDNAMES));
	}

	Map innerMap = ((Map)cacheOfDispIds.get(apiName));
	if (innerMap != null)
	{
		Integer dispId = (Integer)innerMap.get(apiName);
		return dispId.intValue();
	}



	JICallBuilder obj = new JICallBuilder(true);
	obj.setOpnum(2);									//size of the array																	//1st is the num elements and second is the actual values

	JIString name = new JIString(apiName.trim(),JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR);
	JIArray array = new JIArray(new JIPointer[]{new JIPointer(name)},true);
	obj.addInParamAsUUID(UUID.NIL_UUID,JIFlags.FLAG_NULL);
	obj.addInParamAsArray(array,JIFlags.FLAG_NULL);
	obj.addInParamAsInt(1,JIFlags.FLAG_NULL);
	obj.addInParamAsInt(0x800,JIFlags.FLAG_NULL);
	obj.addOutParamAsObject(new JIArray(Integer.class,null,1,true),JIFlags.FLAG_NULL);


	Object[] result = comObject.call(obj);

	if (result == null && obj.isError())
	{
		throw new JIException(obj.getHRESULT());
	}

	innerMap = new HashMap();
	innerMap.put(apiName,((Object[])((JIArray)result[0]).getArrayInstance())[0]);
	cacheOfDispIds.put(apiName,innerMap);


	//first will be the length , and the next will be the actual value.
	return ((Integer)((Object[])((JIArray)result[0]).getArrayInstance())[0]).intValue();//will get the dispatch ID.
}
 
开发者ID:howie,项目名称:jinterop,代码行数:43,代码来源:JIDispatchImpl.java


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