我NullPointerException
在一条线上调用一个方法并将其传递给一个字符串。我只能假设字符串为空。
BufferedReader
它是在几行之前从 readline 初始化的。以下是相关代码:
FileInputStream tmp = null;
try {
tmp = new FileInputStream(file);
} catch (FileNotFoundException e) {
System.err.println("File not found!");
e.printStackTrace();
System.exit(1);
}
DataInputStream dis = new DataInputStream(tmp);
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
create();
try {
data = br.readLine();
} catch (IOException e) {
System.err.println("First readline failed: " + e);
System.exit(1);
}
while (!data.equals(null)) {
process(data);
...
和错误:
Exception in thread "main" java.lang.NullPointerException
at enc.read(enc.java:40)
at enc.main(enc.java:15)