This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Parse large String data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Parse large String data " Watch "Parse large String data " New topic
Author

Parse large String data

Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

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.


Life is easy because we write the source code.....
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

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 ?


Time is what we want the most, but what we use the worst. -- William Penn
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

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

Joined: Sep 10, 2008
Posts: 270

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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parse large String data