-
- 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
,InputStreamReader
,JarFile
,JarInputStream
,JarOutputStream
,LineNumberInputStream
,LineNumberReader
,LogStream
,MemoryCacheImageInputStream
,MemoryCacheImageOutputStream
,MLet
,MulticastSocket
,ObjectInputStream
,ObjectOutputStream
ObjectOutputStream
,OutputStream
,OutputStreamWriter
,Pipe.SinkChannel
,Pipe.SourceChannel
,PipedInputStream
,PipedOutputStream
,PipedReader
,PipedWriter
,PrintStream
,PrintWriter
,PrivateMLet
,ProgressMonitorInputStream
,PushbackInputStream
,PushbackReader
,RandomAccessFile
,Reader
,Recording
,RecordingFile
,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 Closeableextends AutoCloseable
Closeable
是可以关闭的数据源或目标。 调用close方法以释放对象所持有的资源(例如打开的文件)。- 从以下版本开始:
- 1.5
-
-
方法详细信息
-
close
void close() throws IOException
关闭此流并释放与其关联的所有系统资源。 如果流已经关闭,则调用此方法无效。如
AutoCloseable.close()
中所述,关闭可能失败的情况需要特别注意。 在投掷IOException
之前,强烈建议放弃基础资源并在内部将Closeable
标记为已关闭。- Specified by:
-
close
,界面AutoCloseable
- 异常
-
IOException
- 如果发生I / O错误
-
-