public class test {
public static void A(String path){
File file=new File(path);
BufferedReader reader = null;
String line = null;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(file), "GBK"));
while ((line = reader.readLine()) != null) {
/*输出每行内容*/
System.out.println(line);
}
}catch (Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) {
/*文件路径*/
A("E:\\Selected_GWH_Coronavirus_Sequences_2020-12-1-8-49-19.fasta");
}
}
Java 按行读取文件内容
最新推荐文章于 2024-08-16 10:22:19 发布