use org.json instead of Gson

This commit is contained in:
Naoyuki Kanezawa
2014-04-07 02:00:54 +09:00
parent 6454dd014d
commit 77165bd183
5 changed files with 56 additions and 60 deletions

View File

@@ -0,0 +1,27 @@
package com.github.nkzawa.engineio.client;
import org.json.JSONArray;
import org.json.JSONObject;
public class HandshakeData {
public String sid;
public String[] upgrades;
public long pingInterval;
public long pingTimeout;
/*package*/ HandshakeData(JSONObject data) {
JSONArray upgrades = data.getJSONArray("upgrades");
int length = upgrades.length();
String[] _upgrades = new String[length];
for (int i = 0; i < length; i ++) {
_upgrades[i] = upgrades.getString(i);
}
this.sid = data.getString("sid");
this.upgrades = _upgrades;
this.pingInterval = data.getLong("pingInterval");
this.pingTimeout = data.getLong("pingTimeout");
}
}