讀取文件,輸出到控制臺。
阿新 • • 發佈:2017-11-23
test unit rim imp org pack string dem []
package com.google;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import org.junit.Test;
public class Demo {
public static void main(String[] args) {}
@Test
public void readFile02() throws IOException {
FileInputStream fis=new FileInputStream("D:/sql.txt");
InputStreamReader isr=new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line="";
while ((line=br.readLine())!=null) {
System.out.println("sql.append(\" "+line.trim()+"\");");
}
}
}
讀取文件,輸出到控制臺。