JAVA读取文件到内存


private static String getStringValue(File file) throws Exception{
InputStream in
= new BufferedInputStream(new FileInputStream(file));
BufferedReader br
= new BufferedReader(new inputStreamReader(in));
String value = "";
StringBuffer sb = new StringBuffer();
sb.append("\n");
while((value = br.readLine()) != null && !"".equals(value)) {
sb.append("<").append(value).append("> sb.append(">\n");
}
in.close();
br.close();
sb.append("
");
return sb.toString();

}

你可能感兴趣的:(Java,EE)