-
- All Superinterfaces:
-
AutoCloseable
- All Known Subinterfaces:
-
AsynchronousByteChannel
,AsynchronousChannel
,ByteChannel
,Channel
,DirectoryStream<T>
,GatheringByteChannel
,ImageInputStream
,ImageOutputStream
,InterruptibleChannel
,JavaFileManager
,JMXConnector
,ModuleReader
,MulticastChannel
,NetworkChannel
,ReadableByteChannel
,RMIConnection
,ScatteringByteChannel
,SecureDirectoryStream<T>
,SeekableByteChannel
,StandardJavaFileManager
,WatchService
,WritableByteChannel
- 所有已知实现类:
-
AbstractInterruptibleChannel
,AbstractSelectableChannel
,AbstractSelector
,AsynchronousFileChannel
,AsynchronousServerSocketChannel
,AsynchronousSocketChannel
,AudioInputStream
,BufferedInputStream
,BufferedOutputStream
,BufferedReader
,BufferedWriter
,ByteArrayInputStream
,ByteArrayOutputStream
,CharArrayReader
,CharArrayWriter
,CheckedInputStream
,CheckedOutputStream
,CipherInputStream
,CipherOutputStream
,DatagramChannel
,DatagramSocket
,DataInputStream
,DataOutputStream
,DeflaterInputStream
,DeflaterOutputStream
,DigestInputStream
,DigestOutputStream
,FileCacheImageInputStream
,FileCacheImageOutputStream
,FileChannel
,FileImageInputStream
,FileImageOutputStream
,FileInputStream
,FileOutputStream
,FileReader
,FileSystem
,FileWriter
,FilterInputStream
,FilterOutputStream
,FilterReader
,FilterWriter
,Formatter
,ForwardingJavaFileManager
,GZIPInputStream
,GZIPOutputStream
,ImageInputStreamImpl
,ImageOutputStreamImpl
,InflaterInputStream
,InflaterOutputStream
,InputStream
,InputStream
,InputStream
,InputStreamReader
,JarFile
,JarInputStream
,JarOutputStream
JarOutputStream
,LineNumberInputStream
,LineNumberReader
,LogStream
,MemoryCacheImageInputStream
,MemoryCacheImageOutputStream
,MLet
,MulticastSocket
,ObjectInputStream
,ObjectOutputStream
,OutputStream
,OutputStream
,OutputStream
,OutputStreamWriter
,Pipe.SinkChannel
,Pipe.SourceChannel
,PipedInputStream
,PipedOutputStream
,PipedReader
,PipedWriter
,PrintStream
,PrintWriter
,PrivateMLet
,ProgressMonitorInputStream
,PushbackInputStream
,PushbackReader
,RandomAccessFile
,Reader
,RMIConnectionImpl
,RMIConnectionImpl_Stub
,RMIConnector
,RMIIIOPServerImpl
,RMIJRMPServerImpl
,RMIServerImpl
,Scanner
,SctpChannel
,SctpMultiChannel
,SctpServerChannel
,SelectableChannel
,Selector
,SequenceInputStream
,ServerSocket
,ServerSocketChannel
,Socket
,SocketChannel
,SSLServerSocket
,SSLSocket
,StringBufferInputStream
,StringReader
,StringWriter
,URLClassLoader
,URLReader
,Writer
,ZipFile
,ZipInputStream
,ZipOutputStream
public interface Closeable extends AutoCloseable
ACloseable
是可以关闭的数据的源或目的地。 调用close方法来释放对象持有的资源(如打开的文件)。- 从以下版本开始:
- 1.5
-
-
方法详细信息
-
close
void close() throws IOException
关闭此流并释放与之相关联的任何系统资源。 如果流已经关闭,则调用此方法将不起作用。如
AutoCloseable.close()
所述,关闭可能失败的情况需要仔细注意。 强烈建议放弃相关资源,并将Closeable
内部标记为关闭,然后再投入IOException
。- Specified by:
-
close
在接口AutoCloseable
- 异常
-
IOException
- 如果发生I / O错误
-
-