-//
-// Copyright (c) 2013 Ford Motor Company
-//
-package com.smartdevicelink.proxy;
-
-import java.util.Hashtable;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import com.smartdevicelink.marshal.JsonRPCMarshaller;
-import com.smartdevicelink.proxy.constants.Names;
-
-public class RPCStruct {
-
- protected Hashtable<String, Object> store = null;
-
- public RPCStruct() {
- store = new Hashtable<String, Object>();
- }
-
- protected RPCStruct(RPCStruct rpcs) {
- this.store = rpcs.store;
- }
-
- public RPCStruct(Hashtable<String, Object> hashtable) {
- store = hashtable;
- }
-
- public void deserializeJSON(JSONObject jsonObject) throws JSONException {
- store = JsonRPCMarshaller.deserializeJSONObject(jsonObject);
- }
-
- // deserializeJSONObject method moved to JsonRPCMarshaller for consistency
- // Keep reference here for backwards compatibility
- @Deprecated
- public static Hashtable<String, Object> deserializeJSONObject(JSONObject jsonObject)
- throws JSONException {
- return JsonRPCMarshaller.deserializeJSONObject(jsonObject);
- }
-
- public JSONObject serializeJSON() throws JSONException {
- return JsonRPCMarshaller.serializeHashtable(store);
- }
-
- public JSONObject serializeJSON(byte version) throws JSONException {
- if (version == 2) {
- String messageType = (String)store.keys().nextElement();
- Hashtable function = (Hashtable)store.get(messageType);
- Hashtable hash = (Hashtable)function.get(Names.parameters);
- return JsonRPCMarshaller.serializeHashtable(hash);
- } else return JsonRPCMarshaller.serializeHashtable(store);
- }
-}
+package com.smartdevicelink.proxy;\r
+\r
+import java.util.Hashtable;\r
+\r
+import org.json.JSONException;\r
+import org.json.JSONObject;\r
+\r
+import com.smartdevicelink.marshal.JsonRPCMarshaller;\r
+import com.smartdevicelink.proxy.constants.Names;\r
+\r
+public class RPCStruct {\r
+ \r
+ private byte[] _bulkData = null;\r
+\r
+ protected Hashtable<String, Object> store = null;\r
+ \r
+ public RPCStruct() {\r
+ store = new Hashtable<String, Object>();\r
+ }\r
+ \r
+ protected RPCStruct(RPCStruct rpcs) {\r
+ this.store = rpcs.store;\r
+ }\r
+ \r
+ public RPCStruct(Hashtable<String, Object> hashtable) {\r
+ store = hashtable;\r
+ //store = (Hashtable<String, Object>) ObjectCopier.copy(hashtable);\r
+ }\r
+ \r
+ public void deserializeJSON(JSONObject jsonObject) throws JSONException {\r
+ store = JsonRPCMarshaller.deserializeJSONObject(jsonObject);\r
+ }\r
+ \r
+ // deserializeJSONObject method moved to JsonRPCMarshaller for consistency\r
+ // Keep reference here for backwards compatibility\r
+ @Deprecated\r
+ public static Hashtable<String, Object> deserializeJSONObject(JSONObject jsonObject) \r
+ throws JSONException {\r
+ return JsonRPCMarshaller.deserializeJSONObject(jsonObject);\r
+ }\r
+ \r
+ public JSONObject serializeJSON() throws JSONException {\r
+ return JsonRPCMarshaller.serializeHashtable(store);\r
+ }\r
+ \r
+ public JSONObject serializeJSON(byte version) throws JSONException {\r
+ if (version == 2) {\r
+ String messageType = (String)store.keys().nextElement();\r
+ Hashtable function = (Hashtable)store.get(messageType);\r
+ Hashtable parameters = (Hashtable)function.get(Names.parameters);
+ return JsonRPCMarshaller.serializeHashtable(parameters);\r
+ //Hashtable hashToSend = new Hashtable();\r
+ //hashToSend.put(Names.parameters, parameters);\r
+ //return JsonRPCMarshaller.serializeHashtable(hashToSend);\r
+ } else return JsonRPCMarshaller.serializeHashtable(store);\r
+ }\r
+\r
+ public byte[] getBulkData() {\r
+ return this._bulkData;\r
+ }\r
+\r
+ public void setBulkData(byte[] bulkData) {\r
+ if (bulkData != null) {\r
+ this._bulkData = new byte[bulkData.length];\r
+ System.arraycopy(bulkData, 0, _bulkData, 0, bulkData.length);\r
+ //this._bulkData = bulkData;\r
+ }\r
+ }\r
+}\r