使用JAVA读取DNA文本文件

时间:2016-05-29 11:28:24

标签: java bufferedreader

  

我想用java制作这个读取细菌的DNA文本文件   代码

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
// implements a simplified version of "type" command provided in Windows given
// a text file name(s) as argument, it prints the content of the text file(s) on console
class Type {
    public static void main(String[] args) {

        BufferedReader br = null;

        try {

            String sCurrentLine;

            br = new BufferedReader(new FileReader("C:\\Users\\mohamed\\Downloads\\dataset_2_6.txt"));

            while ((sCurrentLine = br.readLine()) != null) {
                System.out.println(sCurrentLine);
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null)br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
}
}
  

但输出为空   ,它在使用小文本文件时起作用

0 个答案:

没有答案