Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parse large String data

 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have getting data after every 2 seconds from server through socket connection. Data is in string format and it is huge data (near about 50kb). I want to parse this data. What is a proper way to parse this large data continously. Thanks in advance.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What design did you try ? How do you want to process the 'data', by 'data' what do you mean ? does it come in a binary file ? does it just come as a "String" type ? Did you try StringBuffer, did you get any performance issues ?
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robin, data is in String format and it also contains some special character I had done parsing like:



I am just thinking is it okay to take this result which is coming from socket is stored in String and then parse that string like above. Or there is any better way?

Thanks>
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There may be more optimized ways...

One I can think off ->



Leave the String array and String creations on java, but only if you are certain that the sockets will return you the string everytime and there will be no validations required. Another thing is using the enhanced for loop to handle tokens.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic