本文整理汇总了Java中org.jinterop.dcom.core.JIArray类的典型用法代码示例。如果您正苦于以下问题:Java JIArray类的具体用法?Java JIArray怎么用?Java JIArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JIArray类属于org.jinterop.dcom.core包,在下文中一共展示了JIArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryAvailableLocaleIDs
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public int[] queryAvailableLocaleIDs() throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(METHOD_INDEX_IOPCCommon_QueryAvailableLocaleIDs);
callObject.addOutParamAsType(Integer.class, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
Object[] result = comObject.call(callObject);
if (callObject.isError())
throw new JIException(callObject.getHRESULT());
Integer count = (Integer) result[0];
if (count == null)
throw new NullPointerException("Count is null");
int[] availLocales = new int[count];
Integer[] returned = (Integer[]) ((JIArray) ((JIPointer) result[1]).getReferent()).getArrayInstance();
for (int i = 0; i < count; i++)
availLocales[i] = returned[i];
return availLocales;
}
示例2: read
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public ReadResult read(Integer[] serverHandles, int transactionId) throws JIException //TODO retval
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(0);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, true), JIFlags.FLAG_NULL);
callObject.addInParamAsInt(transactionId, JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.class, JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIPointer(new JIArray(Integer.class, null, 1, true)), JIFlags.FLAG_NULL);
Object[] result = comObject.call(callObject);
Integer cancelId = (Integer) result[0];
Integer[] errors = (Integer[]) ((JIArray) ((JIPointer) result[1]).getReferent()).getArrayInstance();
Map<Integer, Integer> errorCodes = new HashMap<>();
for (int i = 0; i < serverHandles.length; i++) {
errorCodes.put(serverHandles[i], errors[i]);
}
return new ReadResult(cancelId, errorCodes);
}
示例3: write
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public Map<Integer, Integer> write(Integer[] serverHandles, JIVariant[] values) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(1);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, true), JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(values, 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[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Map<Integer, Integer> codes = new HashMap<>();
for (int i = 0; i < serverHandles.length; i++) {
codes.put(serverHandles[i], errorCodes[i]);
}
return codes;
}
示例4: getEmptyStruct
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public static JIStruct getEmptyStruct() throws JIException
{
JIStruct struct = new JIStruct();
struct.addMember(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR));//szAccessPath
struct.addMember(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_LPWSTR));//szItemID
struct.addMember(Boolean.class);//bActive
struct.addMember(Integer.class);//hClient
struct.addMember(Integer.class);//hServer
struct.addMember(Integer.class);//dwAccessRights
struct.addMember(Integer.class);//dwBlobSize
struct.addMember(new JIPointer(new JIArray(Byte.class, null, 1, true, false))); //pBlob
struct.addMember(Short.class);//vtRequestedDataType
struct.addMember(Short.class);//vtCanonicalDataType
struct.addMember(Integer.class);//dwEUType
struct.addMember(JIVariant.class);//vEUInfo
return struct;
}
示例5: removeItems
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public Map<Integer, Integer> removeItems(Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(2);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, 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[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < serverHandles.length; i++) {
map.put(serverHandles[i], errorCodes[i]);
}
return map;
}
示例6: setActiveState
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public Map<Integer, Integer> setActiveState(boolean active, Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(3);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles, true), JIFlags.FLAG_NULL);
callObject.addInParamAsBoolean(active, 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[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < serverHandles.length; i++) {
map.put(serverHandles[i], errorCodes[i]);
}
return map;
}
示例7: 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);
}
示例8: 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);
}
示例9: releaseItemHandles
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public ResultTable<Integer, Void> releaseItemHandles(Integer[] serverHandles) throws JIException {
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(4);
callObject.addInParamAsInt(serverHandles.length, JIFlags.FLAG_NULL);
callObject.addInParamAsArray(new JIArray(serverHandles), 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[] errorCodes = (Integer[]) ((JIArray) ((JIPointer) result[0]).getReferent()).getArrayInstance();
ResultTable<Integer, Void> resultTable = new ResultTable<>();
for (int i = 0; i < serverHandles.length; i++) {
resultTable.put(serverHandles[i], null, errorCodes[i]);
}
return resultTable;
}
示例10: main
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Server server = new Server(
BaseConfiguration.getCLSIDConnectionInfomation(),
Executors.newSingleThreadScheduledExecutor());
server.connect();
Group group = server.addGroup();
Item item = group.addItem("Square Waves.Real4");
/** 构造写入数据 */
final Float[] integerData = new Float[] { 1202f, 1203f, 1204f };
final JIArray array = new JIArray(integerData, false);
final JIVariant value = new JIVariant(array);
/** 同步写入 */
item.write(value);
Thread.sleep(2000);
/** Dump出item的值 */
dumpItem(item);
server.dispose();
}
示例11: remove
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public ResultSet<Integer> remove ( final Integer... serverHandles ) throws JIException
{
if ( serverHandles.length == 0 )
{
return new ResultSet<Integer> ();
}
final JICallBuilder callObject = new JICallBuilder ( true );
callObject.setOpnum ( 2 );
callObject.addInParamAsInt ( serverHandles.length, JIFlags.FLAG_NULL );
callObject.addInParamAsArray ( new JIArray ( serverHandles, true ), JIFlags.FLAG_NULL );
callObject.addOutParamAsObject ( new JIPointer ( new JIArray ( Integer.class, null, 1, true ) ), JIFlags.FLAG_NULL );
final Object result[] = Helper.callRespectSFALSE ( getCOMObject (), callObject );
final Integer[] errorCodes = (Integer[]) ( (JIArray) ( (JIPointer)result[0] ).getReferent () ).getArrayInstance ();
final ResultSet<Integer> results = new ResultSet<Integer> ( serverHandles.length );
for ( int i = 0; i < serverHandles.length; i++ )
{
results.add ( new Result<Integer> ( serverHandles[i], errorCodes[i] ) );
}
return results;
}
示例12: setActiveState
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public ResultSet<Integer> setActiveState ( final boolean state, final Integer... items ) throws JIException
{
if ( items.length == 0 )
{
return new ResultSet<Integer> ();
}
final JICallBuilder callObject = new JICallBuilder ( true );
callObject.setOpnum ( 3 );
callObject.addInParamAsInt ( items.length, JIFlags.FLAG_NULL );
callObject.addInParamAsArray ( new JIArray ( items, true ), JIFlags.FLAG_NULL );
callObject.addInParamAsInt ( state ? 1 : 0, JIFlags.FLAG_NULL );
callObject.addOutParamAsObject ( new JIPointer ( new JIArray ( Integer.class, null, 1, true ) ), JIFlags.FLAG_NULL );
final Object[] result = Helper.callRespectSFALSE ( getCOMObject (), callObject );
final Integer[] errorCodes = (Integer[]) ( (JIArray) ( (JIPointer)result[0] ).getReferent () ).getArrayInstance ();
final ResultSet<Integer> results = new ResultSet<Integer> ( items.length );
for ( int i = 0; i < items.length; i++ )
{
results.add ( new Result<Integer> ( items[i], errorCodes[i] ) );
}
return results;
}
示例13: next
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public int next ( final List<UUID> list, final int num ) throws JIException
{
if ( num <= 0 )
{
return 0;
}
JICallBuilder callObject = new JICallBuilder ( true );
callObject.setOpnum ( 0 );
callObject.addInParamAsInt ( num, JIFlags.FLAG_NULL );
callObject.addInParamAsInt ( num, JIFlags.FLAG_NULL );
callObject.addOutParamAsObject ( new JIArray ( UUID.class, null, 1, true, true ), JIFlags.FLAG_NULL );
callObject.addOutParamAsType ( Integer.class, JIFlags.FLAG_NULL );
Object[] result = Helper.callRespectSFALSE ( getCOMObject (), callObject );
UUID[] resultData = (UUID[]) ( (JIArray)result[0] ).getArrayInstance ();
Integer cnt = (Integer)result[1];
for ( int i = 0; i < cnt; i++ )
{
list.add ( resultData[i] );
}
return cnt;
}
示例14: 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 );
}
}
示例15: getNames
import org.jinterop.dcom.core.JIArray; //导入依赖的package包/类
public Object[] getNames(int memberId, int maxNames) throws JIException
{
JICallBuilder callObject = new JICallBuilder(true);
callObject.setOpnum(4);
//for experiment only
// JIArray arry = new JIArray(new Integer[]{new Integer(100),new Integer(200)},true);
// JIStruct struct = new JIStruct();
// struct.addMember(Short.valueOf((short)86));
// struct.addMember(arry);
// callObject.addInParamAsStruct(struct,JIFlags.FLAG_NULL);
callObject.addInParamAsInt(memberId,JIFlags.FLAG_NULL);
callObject.addInParamAsInt(maxNames,JIFlags.FLAG_NULL);
callObject.addOutParamAsObject(new JIArray(new JIString(JIFlags.FLAG_REPRESENTATION_STRING_BSTR),null,1,true,true),JIFlags.FLAG_NULL);
callObject.addOutParamAsType(Integer.class,JIFlags.FLAG_NULL);
return comObject.call(callObject);
}