Zaitung
17/02/14, 12:59:32
Tengo una app que se descarga un fichero en formato JSON de una pagina web, una vez que lo tengo le voy extrayendo los campos que necesito, de la siguiente manera:
try {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse httpResponse = httpclient.execute(new HttpGet(URL));
inputStream = httpResponse.getEntity().getContent();
if(inputStream != null){
result = convertInputStreamToString(inputStream);
}
else
result = "Did not work!";
} catch (IOException ex) {
ex.printStackTrace();
}
JSSONObject jsonObj = new JSONObject(result);
File= jsonObj.getJSONArray("resources");
for (int i = 0; i < File.length(); i++) {
JSONObject c = File.getJSONObject(i);
variable1= c.getDouble("TAG");
}
Sin embargo ese fichero tiene una gran cantidad de registros y a veces llega a tardar varios minutos.
No se si hay alguna manera de leerlo mas rápido o si en otro formato aceleraría la búsqueda (tengo disponibles RDF/XML, HTML, JSON, N3, XML, TURTLE, CSV, ATOM, JSONLD)
:gracias::gracias:
try {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse httpResponse = httpclient.execute(new HttpGet(URL));
inputStream = httpResponse.getEntity().getContent();
if(inputStream != null){
result = convertInputStreamToString(inputStream);
}
else
result = "Did not work!";
} catch (IOException ex) {
ex.printStackTrace();
}
JSSONObject jsonObj = new JSONObject(result);
File= jsonObj.getJSONArray("resources");
for (int i = 0; i < File.length(); i++) {
JSONObject c = File.getJSONObject(i);
variable1= c.getDouble("TAG");
}
Sin embargo ese fichero tiene una gran cantidad de registros y a veces llega a tardar varios minutos.
No se si hay alguna manera de leerlo mas rápido o si en otro formato aceleraría la búsqueda (tengo disponibles RDF/XML, HTML, JSON, N3, XML, TURTLE, CSV, ATOM, JSONLD)
:gracias::gracias: