Switch to full style
General Java code examples
Post a reply

Read file content to StringBuffer String object

Thu Feb 07, 2013 8:09 pm

Read file content to StringBuffer String object

java code
import java.io.*;

public class FileSpace {

private FileInputStream in;

public FileSpace(String filename) {
in = new FileInputStream(filename);
}

public String readWord() {
int c;
StringBuffer buf = new StringBuffer();

do {
c = in.read();
if (Character.isSpace((char)c))
return buf.toString();
else
buf.append((char)c);
} while (c != -1);

return buf.toString();
}
}




Post a reply
  Related Posts  to : Read file content to StringBuffer String object
 Read XML file content using SAX and writing its as SQL     -  
 difference between the String and StringBuffer     -  
 help me regarding StringBuffer.indexOf(String)     -  
 Read the content from directory     -  
 Print the content of hashMap object     -  
 How to read string text in files     -  
 Converting Session object into string     -  
 display the content of text file     -  
 Load file and update content using AJAX and JQuery     -  
 Read csv file     -  

Topic Tags

Java Strings