java.io
接口 Closeable
public interface Closeable
Closeable 是能夠關閉的數據源或目標。調用 close 方法可釋放對象保存的資源(如打開文件)。java
-
從如下版本開始:1.5
方法摘要 |
void |
close() 關閉此流並釋放與此流關聯的全部系統資源。 |
close
void close()
throws IOException
-
關閉此流並釋放與此流關聯的全部系統資源。
若是已經關閉該流,則調用此方法無效。
-
-
拋出:
-
IOException
- 若是發生 I/O 錯誤
-
全部已知子接口:
-
ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, JavaFileManager, JMXConnector, ReadableByteChannel, RMIConnection, ScatteringByteChannel, StandardJavaFileManager, WritableByteChannel
-
全部已知實現類:
-
AbstractInterruptibleChannel, AbstractSelectableChannel, AudioInputStream,
BufferedInputStream, BufferedOutputStream, BufferedReader, BufferedWriter, ByteArrayInputStream, ByteArrayOutputStream, CharArrayReader, CharArrayWriter, CheckedInputStream, CheckedOutputStream, CipherInputStream, CipherOutputStream, DatagramChannel,
DataInputStream, DataOutputStream, DeflaterInputStream, DeflaterOutputStream, DigestInputStream, DigestOutputStream, FileChannel,
FileInputStream, FileOutputStream, FileReader, FileWriter, FilterInputStream, FilterOutputStream, FilterReader, FilterWriter, Formatter, ForwardingJavaFileManager,
GZIPInputStream, GZIPOutputStream, InflaterInputStream, InflaterOutputStream,
InputStream, InputStreamReader, JarInputStream, JarOutputStream, LineNumberInputStream, LineNumberReader, LogStream,
ObjectInputStream, ObjectOutputStream, OutputStream, OutputStream, OutputStreamWriter, Pipe.SinkChannel, Pipe.SourceChannel,
PipedInputStream, PipedOutputStream, PipedReader, PipedWriter, PrintStream, PrintWriter, ProgressMonitorInputStream,
PushbackInputStream,
PushbackReader, RandomAccessFile, Reader, RMIConnectionImpl, RMIConnectionImpl_Stub, RMIConnector, RMIIIOPServerImpl, RMIJRMPServerImpl, RMIServerImpl, SelectableChannel, SequenceInputStream, ServerSocketChannel, SocketChannel,
StringBufferInputStream,
StringReader, StringWriter, Writer, ZipInputStream, ZipOutputStream