小编Jud*_*tor的帖子

如何关闭FileInputStream会导致"设备上没有剩余空间"错误?

我对程序最近开始抛出的错误感到困惑.

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)
Run Code Online (Sandbox Code Playgroud)

我假设因为这是一个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();
        } 
Run Code Online (Sandbox Code Playgroud)

如您所见,我只打开文件,阅读一些内容,然后关闭文件.

java exception ioexception fileinputstream

9
推荐指数
1
解决办法
1358
查看次数

标签 统计

exception ×1

fileinputstream ×1

ioexception ×1

java ×1