标签:util ringbuf substring epo buffer encoding ora under font
String folder = "/nasapp/datamerger/xmls/ " ;
File file = new File(folder);
if(!file.exists()){
file.mkdir();
}
File[] files = file.listFiles();
for(File f:files){
try {
if (f.isFile() && f.exists() && "xml".equals(f.getName().substring(f.getName().lastIndexOf(".")+1))) {
StringBuffer buffer = new StringBuffer();
String encoding = "UTF-8";
InputStreamReader read = new InputStreamReader(new FileInputStream(f), encoding);
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
while ((lineTxt = bufferedReader.readLine()) != null) {
buffer.append(lineTxt);
}
read.close();
if(buffer!=null && StringUtils.isNotBlank(buffer.toString())){
String report = buffer.toString();}
批量读文件为一个String(一个文件夹下的大量xml文件)
标签:util ringbuf substring epo buffer encoding ora under font
原文地址:http://www.cnblogs.com/anobugworld/p/7112209.html