Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I use StringBuffer in this case...  RSS feed

 
Hemal Mehta
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!