import static ro.ieval.fonbot.Utils.toNonNull;
import java.io.InputStream;
+import org.eclipse.jdt.annotation.Nullable;
import org.json.JSONArray;
import org.json.JSONObject;
}
@Override
- public void onResult(int responseCode, String responseMessage,
- InputStream inputStream) {
- if(responseCode!=200)
+ public void onResult(final int responseCode, final String responseMessage, final @Nullable InputStream inputStream) {
+ if(responseCode!=200 || inputStream==null)
return;
final Handler handler=new Handler(Looper.getMainLooper());
try{
final JSONArray array;
{
- final byte[] buf=new byte[4096*1024];
- inputStream.read(buf);
- array=new JSONArray(new String(buf));
+ final byte[] buf=new byte[2048*1024];
+ final int length=inputStream.read(buf);
+ array=new JSONArray(new String(buf, 0, length));
}
for(int i=0;i<array.length();i++){