android - How much data can you get using HttpUrlConnection -


i following examples android course @ udacity made google , replaced url of example other 1 can see, using log small portion of url downloading.

public class fetchweathertask extends asynctask<void, void, void> {     private  final string log_tag = fetchweathertask.class.getsimplename();     @override     protected void doinbackground(void... params) {         // these 2 need declared outside try/catch         // can closed in block.         httpurlconnection urlconnection = null;         bufferedreader reader = null;          // contain raw json response string.         string forecastjsonstr = null;          try {             // construct url openweathermap query             // possible parameters available @ owm's forecast api page, @             // http://openweathermap.org/api#forecast             url url = new url("http://api.openweathermap.org/data/2.5/forecast/daily?q=94043&mode=json&units=metric&cnt=7");              // create request openweathermap, , open connection             urlconnection = (httpurlconnection) url.openconnection();             urlconnection.setrequestmethod("get");             urlconnection.connect();              // read input stream string             inputstream inputstream = urlconnection.getinputstream();             stringbuffer buffer = new stringbuffer();             if (inputstream == null) {                 // nothing do.                 return null;             }             reader = new bufferedreader(new inputstreamreader(inputstream));              string line;             while ((line = reader.readline()) != null) {                 // since it's json, adding newline isn't necessary (it won't affect parsing)                 // make debugging *lot* easier if print out completed                 // buffer debugging.                 buffer.append(line + "\n");             }              if (buffer.length() == 0) {                 // stream empty.  no point in parsing.                 return null;             }             forecastjsonstr = buffer.tostring();             log.v(log_tag, "forecast json string: " + forecastjsonstr);         } catch (ioexception e) {             log.e(log_tag, "error ", e);             // if code didn't weather data, there's no point in attemping             // parse it.             return null;         } finally{             if (urlconnection != null) {                 urlconnection.disconnect();             }             if (reader != null) {                 try {                     reader.close();                 } catch (final ioexception e) {                     log.e(log_tag, "error closing stream", e);                 }             }         }          return null;     } } 

is there limitation of how data can download?

my response in log:

v/fetchweathertask﹕ forecast json string: {"cod":"200","message":0.0506,"city":{"id":0,"name":"mountain view","country":"us","coord":{"lat":37.4056,"lon":-122.0775}},"cnt":7,"list":[{"dt":1427572800,"temp":{"day":22.34,"min":6.06,"max":22.41,"night":6.06,"eve":16.73,"morn":9.62},"pressure":995.73,"humidity":49,"weather":[{"id":500,"main":"rain","description":"light rain","icon":"10d"}],"speed":1.95,"deg":339,"clouds":32},{"dt":1427659200,"temp":{"day":23.84,"min":5.16,"max":23.84,"night":6.98,"eve":16.84,"morn":5.16},"pressure":993.22,"humidity":46,"weather":[{"id":800,"main":"clear","description":"sky clear","icon":"01d"}],"speed":1.33,"deg":297,"clouds":0},{"dt":1427745600,"temp":{"day":16.45,"min":8.95,"max":17.99,"night":11.51,"eve":17.99,"morn":8.95},"pressure":1011.5,"humidity":0,"weather":[{"id":500,"main":"rain","description":"light rain","icon":"10d"}],"speed":2.24,"deg":292,"clouds":51},{"dt":1427832000,"temp":{"day":14.62,"min":8.79,"max":18.33,"night":12.9,"eve":18.33,"morn":8.79},"pressure":1014.65,"humidity":0,"weather":[{"id":500,"main":"rain","description":"light rain","icon":"10d"}],"speed":4.02,"deg":324,"clouds":0},{"dt":1427918400,"temp":{"day":15.37,"min":9.92,"max":17.5,"night":14.15,"eve":17.5,"morn":9.92},"pressure":1012.74,"humidity":0,"weather":[{"id":800,"main":"clear","description":"sky clear","icon":"01d"}],"speed":3.46,"deg":312,"clouds":5},{"dt":1428004800,"temp":{"day":14.2,"min":10.92,"max":16.56,"night":14.1,"eve":16.56,"morn":10.92},"pressure":1011.2,"humidity":0,"weather":[{"id":800,"main":"clear","description":"sky clear","icon":"01d"}],"speed":6.67,"deg":330,"clouds":0},{"dt":1428091200,"temp":{"day":16.39,"min":10.38,"max":17.89,"night":11.01,"eve":17.89,"morn":10.38},"pressure":1014.68,"humidity":0,"weather":[{"id":800,"main":"clear","description":"sky clear","icon":"01d"}],"speed":3.81,"deg":338,"clouds":0}]}

definitely there limit, larger logs such json responses, try segment response (json response collection of objects array of items, try convert response jason array , 1 one) , print several log functions rather trying print whole response in single log function.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -