Package java.io

Interface Closeable

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, WritableByteChannel
All Known Implementing Classes:
AbstractInterruptibleChannel, AbstractOutputStream, AbstractSelectableChannel, AbstractSelector, ASN1InputStream, BufferedInputStream, BufferedOutputStream, BufferedReader, BufferedWriter, ByteArrayInputStream, ByteArrayOutputStream, CharArrayReader, CharArrayWriter, CheckedInputStream, CheckedOutputStream, ChunkedInputStream, ChunkedOutputStream, CipherInputStream, CipherInputStream, CipherOutputStream, CipherOutputStream, Connection, ContentLengthInputStream, ContentLengthOutputStream, DatagramChannel, DatagramSocket, DataInputStream, DataOutputStream, DeflaterInputStream, DeflaterOutputStream, DigestInputStream, DigestInputStream, DigestOutputStream, DigestOutputStream, DiskLruCache, DiskLruCache.Snapshot, EofSensorInputStream, FaultRecoveringOutputStream, FileChannel, FileInputStream, FileOutputStream, FileReader, FileWriter, FilterInputStream, FilterOutputStream, FilterReader, FilterWriter, Formatter, GZIPInputStream, GZIPOutputStream, HandshakeIODataStream, IdentityInputStream, IdentityOutputStream, InflaterInputStream, InflaterOutputStream, InputStream, InputStreamReader, JarFile, JarInputStream, JarOutputStream, KXmlParser, LineNumberInputStream, LineNumberReader, Logger.Stream, MacInputStream, MacOutputStream, MacOutputStream, MulticastSocket, ObjectInputStream, ObjectOutputStream, OpenSSLBIOInputStream, OpenSSLServerSocketImpl, OpenSSLSocketImpl, OpenSSLSocketImplWrapper, OutputStream, OutputStreamWriter, PemReader, PemWriter, Pipe.SinkChannel, Pipe.SourceChannel, PipedInputStream, PipedOutputStream, PipedReader, PipedWriter, PrintStream, PrintWriter, PushbackInputStream, PushbackReader, RandomAccessFile, RawSocket, Reader, Scanner, SelectableChannel, Selector, SequenceInputStream, ServerSocket, ServerSocketChannel, Socket, SocketChannel, SpdyConnection, SSLBufferedInput, SSLInputStream, SSLServerSocket, SSLServerSocketImpl, SSLSocket, SSLSocketImpl, SSLSocketInputStream, SSLSocketOutputStream, SSLSocketWrapper, SSLStreamedInput, StrictLineReader, StrictLineReader, StringBufferInputStream, StringReader, StringWriter, TeeInputStream, TeeOutputStream, Writer, ZipFile, ZipInputStream, ZipOutputStream

public interface Closeable
extends AutoCloseable
An AutoCloseable whose close method may throw an IOException.
  • Method Summary

    Modifier and Type Method Description
    void close()
    Closes the object and release any system resources it holds.
  • Method Details

    • close

      void close() throws IOException
      Closes the object and release any system resources it holds.

      Although only the first call has any effect, it is safe to call close multiple times on the same object. This is more lenient than the overridden AutoCloseable.close(), which may be called at most once.

      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException