06-07-2011 05:21 AM
whats the maximum data can be read ? my app reads 1.2mb data from server ,converts inputstream to strign and gives it to json parsing. my mds server configured to receive 1024kbs (IPPP.connection.MaxNumberOfKBytesToSend=1024 )
since my data is 1.2mb i changed the above value to 2048,1500 and checked out.. now response code is 200 but it never enters my json parsing code..i tried in debug mode too as soon as it complets reading from server app stops..
am unable to figure out poblem.. can u please help me ?
06-07-2011 05:30 AM
06-07-2011 01:08 PM
I recommend you divide this problem into two parts
a) Download the data to the SD Card and save the bytes. Then you can free up the connection. You could use this approach so that you don't have to worry about connection limits:
b) Parse the file from the SD Card.
You can actually develop and test both of these parts independently. And you test how long each is going to take.
With respect to speeding up the parsing, there is little you can do about this, unless you try an easier to parse format. In terms of 'standard' formats, I think json is about the most efficient, but if you know the stricture of your data perhaps you can design something specific for your situation.
But in your situation, I would try to redesign the approach around a smaller download. Perhaps you can receive and process a bit at a time?
06-08-2011 12:19 AM - edited 06-08-2011 12:20 AM
Thanks for the reply peter..i will try this method
one thing i figured out in my app is data is successfully getting downloaded from server ..but while parsing that too especially getting json object from string (downloaded input stream is converted to string and given to json parser) app stops working..
jObject = new JSONObject(response); // app stops working here
is that the string is too large for parser to process ?
06-08-2011 09:32 AM
"is that the string is too large"
Sorry, I have no idea,
In your situation I would probably look at the json source and try to figure out where to put some 'debugging' in and try that. If you are developing in OS 6.0 and using the standard json parser this won't be possible, so you will need to get your own json source and include that. There are a number of Threads on this forum that shoud help you with doing this.
Or try some smaller string, steadily increasing length?
06-08-2011 09:47 AM
06-09-2011 07:04 AM
My protocol uses JSON messages that are around 2 megabytes at the moment, and at least Curve 8520 (and 9800 simulator) can deal with it, although slowly. The part that takes most time is indeed creating the initial JSONObject.
I am not using the JSON library that ships with 6.0.0, though (because it is not available on 5.0.0, and because it contains a rather stupid bug (StringWriter with no #toString)) - I am using the org.json.me library that I think was used when RIM implemented its own JSON library.