* @version 1.0
* @since 2016-10-04
*/
-public class IoTRMICall {
+public final class IoTRMICall {
/**
*/
private IoTRMIUtil rmiUtil;
private IoTSocketClient rmiClient;
- //private List<String> listMethodId; // Map from method ID to signature
/**
return retObj;
}
-
-
- public static void main(String[] args) throws Exception {
-
- String[] test = { "123", "456", "789" };
- byte[] b = IoTRMIUtil.getObjectBytes(test);
-
- Boolean[] test2 = new Boolean[] { true, false, false };
- byte[] b2 = IoTRMIUtil.getObjectBytes(test2);
-
- System.out.println(Arrays.toString(b));
- System.out.println(Arrays.toString(b2));
-
- String[] c = (String[]) IoTRMIUtil.getParamObjectArray(String[].class, b);
- System.out.println(Arrays.toString(c));
-
- Boolean[] c2 = (Boolean[]) IoTRMIUtil.getParamObjectArray(Boolean[].class, b2);
- System.out.println(Arrays.toString(c2));
-
- IoTRMICall rmiCall = new IoTRMICall(1234, "localhost", 0);
- byte[] retObjBytes = { 0, 0, 4, -46, 0, 0, 0, 10, 116, 101, 115, 116, 115, 116, 114, 105, 110, 103, 0, 0, 21, 56 };
- //Class<?>[] retCls = new Class<?>[] { int.class, String.class, int.class };
- Object[] retObj = rmiCall.getReturnObjects(retObjBytes, new Class<?>[] { int.class, String.class, int.class },
- new Class<?>[] { null, null, null });
- System.out.println("Ret object 1: " + retObj[0]);
- System.out.println("Ret object 2: " + retObj[1]);
- System.out.println("Ret object 3: " + retObj[2]);
-
- // List
- /*List<Long> list = new ArrayList<Long>();
- list.add(12345678l);
- list.add(23455432l);
- list.add(34566543l);
-
- byte[] objBytes = IoTRMIUtil.getObjectBytes(list);
- System.out.println(Arrays.toString(objBytes));
- Object obj = IoTRMIUtil.getParamObject(List.class, null, Long.class, objBytes);
-
- @SuppressWarnings("unchecked")
- List<Long> listStr = (List<Long>) obj;
- System.out.println("List: " + listStr.toString());*/
-
- //@SuppressWarnings("unchecked")
- //List<Long> listStr = (List<Long>) obj;
- //System.out.println("List: " + listStr.toString());
-
- }
}