public interface Closeable extends AutoCloseable
Closeable
是可以关闭的数据的源或目的地。
调用close方法来释放对象持有的资源(如打开的文件)。
void close() throws IOException
如AutoCloseable.close()
所述,关闭可能失败的情况需要仔细注意。 强烈建议放弃对底层资源,并在内部标记 Closeable
为封闭的,前投掷IOException
。
close
在界面
AutoCloseable
IOException
- 如果发生I / O错误
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.