import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class MaxController {
public static void main(String[] args) throws IOException {
FileInputStream sr = new FileInputStream("C:\\Users\\Administrator.SD--20160818IKP\\Desktop\\demo\\src\\main\\java\\com\\example\\controller\\query.txt");
/*int len = sr.available();
byte[] buffer = null;
String str = sr.read(buffer,0,len);*/
byte[]chars=new byte[1024];
int len;
while ((len=sr.read(chars))!=-1){
String s = new String(chars, 0, len);
System.out.println(s);
}
sr.close();
}
}
java读取字符文件(读取全部)
最新推荐文章于 2024-04-18 16:26:01 发布