From: Marius Gavrilescu Date: Tue, 12 Mar 2013 08:56:52 +0000 (+0200) Subject: Improve JSON parsing X-Git-Tag: 0.000_001~57 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=9ead79ec352a50d44f9eefb2496d4471733215e8;hp=8bfdcf7a444359151c18720b01443d6f507bec7e;p=fonbot.git Improve JSON parsing Command arguments are now represented as JSON arrays, and the JSON parsing code uses less memory. Previous versions can no longer receive commands, since they expect command arguments in the old arg0, arg1, ... form. --- diff --git a/src/ro/ieval/fonbot/PollServerAsyncTask.java b/src/ro/ieval/fonbot/PollServerAsyncTask.java index 1be09c3..07c014b 100644 --- a/src/ro/ieval/fonbot/PollServerAsyncTask.java +++ b/src/ro/ieval/fonbot/PollServerAsyncTask.java @@ -109,24 +109,29 @@ public final class PollServerAsyncTask extends AsyncTask list=new ArrayList(); + + final JSONArray array; + { + final byte[] buf=new byte[4096*1024]; + conn.getInputStream().read(buf); + array=new JSONArray(new String(buf)); + } + for(int i=0;i