try {
Resource resource = new ClassPathResource("area-code/relayNumber.json");
reader = new BufferedReader(new InputStreamReader(resource.getInputStream()));
//每次读取文件的缓存
String temp = null;
while ((temp = reader.readLine()) != null) {
data.append(temp);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
//关闭文件流
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
String str = data.toString();
网友评论