最近我的程序出现了一个错误,让我有些困惑。
java.io.IOException: No space left on device
at java.io.FileInputStream.close0(Native Method)
at java.io.FileInputStream.close(FileInputStream.java:259)
at java.io.FilterInputStream.close(FilterInputStream.java:155)
我假设由于这是一个FileInputStream,所以该文件被保存在内存中而不是物理磁盘上。内存使用率看起来很好,磁盘空间也很充足。这尤其令人困惑,因为它发生在关闭FileInputStream时。如果您能解释一下这种情况如何发生,谢谢。
编辑:代码供审查
if (this.file.exists()) {
DataInputStream is = new DataInputStream(new FileInputStream(this.file));
this.startDate = new DateTime(is.readLong(), this.timeZone);
this.endDate = new DateTime(is.readLong(), this.timeZone);
is.close();
}
正如您在上面所看到的,我只是打开文件,读取一些内容,然后关闭文件。