File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Parsing of StringBuffer(URGENT) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Parsing of StringBuffer(URGENT)" Watch "Parsing of StringBuffer(URGENT)" New topic

Parsing of StringBuffer(URGENT)

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
I have defined String Buffer of 2K capacity. Server is send me data withing that capacity of string Buffer. After StringBuffer recieves data from the server on client side, I want to parse it. I have delimeter ":" to parse the stringBuffer?
I tried to use StringTokenizer, Substring. But I can't get it.
Here is my example:
import java.applet.Applet;
import java.util.*;
public class sbDemo extends Applet{
StringBuffer sb;
StringTokenizer st;
public void init(){
st = new StringTokenizer(sb,":");
System.out.println("The String is --->" + st.nextToken());
Michael Dean

Joined: Jul 31, 2000
Posts: 9
Angela: modify your code as follows:
st = new StringTokenizer(sb.toString(),":");
StringTokenizer takes arguments of type String, not StringBuffer...

I agree. Here's the link:
subject: Parsing of StringBuffer(URGENT)
It's not a secret anymore!