java读取文件夹下txt文件中特定信息
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class TestRead {
public static void main(String[] args) throws IOException {
String uri = "d:\123.txt"
FileInputStream fis = new FileInputStream(uri);
InputStreamReader isr =new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
String s;
while((s=br.readLine())!=null){
//每次读取一行
}
}
}
现在一个文件夹在E盘下,路径为"E:\\七年级",七年级文件夹下有"n.txt,n[1].txt,n[2].txt,n[3].txt"以此类推到n[100].txt。每个txt文件中都包含了json格式的学生基本信息,如打开n.txt中信息如下:[{"sex":"0","date_created":"9/1/2017","city":"合肥"