Java-文本文件读取字符(模板)

File file = new File();
FileInputStream fileInputStream = new FileInputStream(file);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
LineNumberReader lineNumberReader = new LineNumberReader(inputStreamReader);
String[] str = new String[lineNumberReader.getLineNumber()];
String len ;
for (int i = 0; i <str.length ; i++) {
    str[i] = bufferedReader.readLine();
}
posted @ 2024-11-09 23:19  基础狗  阅读(3)  评论(0编辑  收藏  举报