代码语言:javascript复制
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class ClassInfoSort {
public static void main(String[] args) {
reader();
}
public static void reader() {
File file = new File("test.txt");
FileInputStream fin = null;
try {
fin = new FileInputStream(file);
byte[] b = new byte[fin.available()];
fin.read(b);
String str = new String(b,"UTF-8");
System.out.println(str);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fin.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}