public static void read(String filePath){
try(FileInputStream file = new FileInputStream(filePath)) {
StringBuilder sb = new StringBuilder();
int tem = 0;
while ((tem=file.read())!=-1){
sb.append((char) tem);
}
System.out.println(sb);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)