File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I use StringBuffer in this case...

 
Hemal Mehta
Ranch Hand
Posts: 101
  • 0
  • 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
  • 0
  • 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