aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How can I use StringBuffer in this case... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How can I use StringBuffer in this case..." Watch "How can I use StringBuffer in this case..." New topic
Author

How can I use StringBuffer in this case...

Hemal Mehta
Ranch Hand

Joined: Nov 16, 2000
Posts: 101
DataInputStream dis = null;
String textRecord = null;
try {
File f = new File("e:\\staging");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
// read the first record of the database
while ( (textRecord = dis.readLine()) != null) {

}
I want to use StringBuffer instaed of sString to
read the above values from eachh line. How can I do that as readLine returns a String.
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Simple - just use the String that is returned by readLine as an argument to the append method of StringBuffer, like this:

Hope that helps,
Corey


SCJP Tipline, etc.
 
Consider Paul's rocket mass heater.
 
subject: How can I use StringBuffer in this case...