# AutoCloseable

public interface **AutoCloseable**

|---|---|---|
| Known Indirect Subclasses [AbstractInterruptibleChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractInterruptibleChannel.html), [AbstractSelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractSelectableChannel.html), [AbstractSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractSelector.html), [AsynchronousByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousByteChannel.html), [AsynchronousChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannel.html), [AsynchronousFileChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousFileChannel.html), [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html), [AsynchronousSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html), [BaseStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html)\<T, S extends [BaseStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html)\<T, S\>\>, [BufferedInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedInputStream.html), [BufferedOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedOutputStream.html), [BufferedReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedReader.html), [BufferedWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedWriter.html), [ByteArrayInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ByteArrayInputStream.html), and [97 others.](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable#) |---|---| | [AbstractInterruptibleChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractInterruptibleChannel.html) | Base implementation class for interruptible channels. | | [AbstractSelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractSelectableChannel.html) | Base implementation class for selectable channels. | | [AbstractSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractSelector.html) | Base implementation class for selectors. | | [AsynchronousByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousByteChannel.html) | An asynchronous channel that can read and write bytes. | | [AsynchronousChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousChannel.html) | A channel that supports asynchronous I/O operations. | | [AsynchronousFileChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousFileChannel.html) | An asynchronous channel for reading, writing, and manipulating a file. | | [AsynchronousServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousServerSocketChannel.html) | An asynchronous channel for stream-oriented listening sockets. | | [AsynchronousSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousSocketChannel.html) | An asynchronous channel for stream-oriented connecting sockets. | | [BaseStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html)\<T, S extends [BaseStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html)\<T, S\>\> | Base interface for streams, which are sequences of elements supporting sequential and parallel aggregate operations. | | [BufferedInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedInputStream.html) | A `BufferedInputStream` adds functionality to another input stream-namely, the ability to buffer the input and to support the `mark` and `reset` methods. | | [BufferedOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedOutputStream.html) | The class implements a buffered output stream. | | [BufferedReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedReader.html) | Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. | | [BufferedWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/BufferedWriter.html) | Writes text to a character-output stream, buffering characters so as to provide for the efficient writing of single characters, arrays, and strings. | | [ByteArrayInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ByteArrayInputStream.html) | A `ByteArrayInputStream` contains an internal buffer that contains bytes that may be read from the stream. | | [ByteArrayOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ByteArrayOutputStream.html) | This class implements an output stream in which the data is written into a byte array. | | [ByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ByteChannel.html) | A channel that can read and write bytes. | | [CallableStatement](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/CallableStatement.html) | The interface used to execute SQL stored procedures. | | [Channel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html) | A nexus for I/O operations. | | [CharArrayReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/CharArrayReader.html) | This class implements a character buffer that can be used as a character-input stream. | | [CharArrayWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/CharArrayWriter.html) | This class implements a character buffer that can be used as an Writer. | | [CheckedInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/CheckedInputStream.html) | An input stream that also maintains a checksum of the data being read. | | [CheckedOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/CheckedOutputStream.html) | An output stream that also maintains a checksum of the data being written. | | [CipherInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/CipherInputStream.html) | A CipherInputStream is composed of an InputStream and a Cipher so that read() methods return data that are read in from the underlying InputStream but have been additionally processed by the Cipher. | | [CipherOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/javax/crypto/CipherOutputStream.html) | A CipherOutputStream is composed of an OutputStream and a Cipher so that write() methods first process the data before writing them out to the underlying OutputStream. | | [Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html) | A `Closeable` is a source or destination of data that can be closed. | | [Connection](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/Connection.html) | A connection (session) with a specific database. | | [DataInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInputStream.html) | A data input stream lets an application read primitive Java data types from an underlying input stream in a machine-independent way. | | [DataOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutputStream.html) | A data output stream lets an application write primitive Java data types to an output stream in a portable way. | | [DatagramChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/DatagramChannel.html) | A selectable channel for datagram-oriented sockets. | | [DatagramSocket](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/DatagramSocket.html) | This class represents a socket for sending and receiving datagram packets. | | [DeflaterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html) | Implements an input stream filter for compressing data in the "deflate" compression format. | | [DeflaterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html) | This class implements an output stream filter for compressing data in the "deflate" compression format. | | [DigestInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/DigestInputStream.html) | A transparent stream that updates the associated message digest using the bits going through the stream. | | [DigestOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/DigestOutputStream.html) | A transparent stream that updates the associated message digest using the bits going through the stream. | | [DirectoryStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/DirectoryStream.html)\<T\> | An object to iterate over the entries in a directory. | | [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html) | A sequence of primitive double-valued elements supporting sequential and parallel aggregate operations. | | [FileChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/FileChannel.html) | A channel for reading, writing, mapping, and manipulating a file. | | [FileInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FileInputStream.html) | A `FileInputStream` obtains input bytes from a file in a file system. | | [FileLock](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/FileLock.html) | A token representing a lock on a region of a file. | | [FileOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FileOutputStream.html) | A file output stream is an output stream for writing data to a `File` or to a `FileDescriptor`. | | [FileReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FileReader.html) | Convenience class for reading character files. | | [FileSystem](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystem.html) | Provides an interface to a file system and is the factory for objects to access files and other objects in the file system. | | [FileWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FileWriter.html) | Convenience class for writing character files. | | [FilterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html) | A `FilterInputStream` contains some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. | | [FilterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterOutputStream.html) | This class is the superclass of all classes that filter output streams. | | [FilterReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterReader.html) | Abstract class for reading filtered character streams. | | [FilterWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterWriter.html) | Abstract class for writing filtered character streams. | | [Formatter](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Formatter.html) | An interpreter for printf-style format strings. | | [GZIPInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/GZIPInputStream.html) | This class implements a stream filter for reading compressed data in the GZIP file format. | | [GZIPOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/GZIPOutputStream.html) | This class implements a stream filter for writing compressed data in the GZIP file format. | | [GatheringByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/GatheringByteChannel.html) | A channel that can write bytes from a sequence of buffers. | | [InflaterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/InflaterInputStream.html) | This class implements a stream filter for uncompressing data in the "deflate" compression format. | | [InflaterOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/InflaterOutputStream.html) | Implements an output stream filter for uncompressing data stored in the "deflate" compression format. | | [InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) | This abstract class is the superclass of all classes representing an input stream of bytes. | | [InputStreamReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStreamReader.html) | An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html`. | | [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html) | A sequence of primitive int-valued elements supporting sequential and parallel aggregate operations. | | [InterruptibleChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/InterruptibleChannel.html) | A channel that can be asynchronously closed and interrupted. | | [JarFile](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/JarFile.html) | The `JarFile` class is used to read the contents of a jar file from any file that can be opened with `java.io.RandomAccessFile`. | | [JarInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/JarInputStream.html) | The `JarInputStream` class is used to read the contents of a JAR file from any input stream. | | [JarOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/JarOutputStream.html) | The `JarOutputStream` class is used to write the contents of a JAR file to any output stream. | | [LineNumberInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/LineNumberInputStream.html) | *This class is deprecated. This class incorrectly assumes that bytes adequately represent characters. As of JDK 1.1, the preferred way to operate on character streams is via the new character-stream classes, which include a class for counting line numbers.* | | [LineNumberReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/LineNumberReader.html) | A buffered character-input stream that keeps track of line numbers. | | [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | A sequence of primitive long-valued elements supporting sequential and parallel aggregate operations. | | [MulticastChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/MulticastChannel.html) | A network channel that supports Internet Protocol (IP) multicasting. | | [MulticastSocket](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/MulticastSocket.html) | The multicast datagram socket class is useful for sending and receiving IP multicast packets. | | [NetworkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/NetworkChannel.html) | A channel to a network socket. | | [ObjectInput](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html) | Defines an interface for classes that allow reading serialized objects. | | [ObjectInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInputStream.html) | An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream. | | [ObjectOutput](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html) | Defines an interface for classes that allow reading serialized objects. | | [ObjectOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutputStream.html) | An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream. | | [OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) | This abstract class is the superclass of all classes representing an output stream of bytes. | | [OutputStreamWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStreamWriter.html) | A class for turning a character stream into a byte stream. | | [Pipe.SinkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.SinkChannel.html) | A channel representing the writable end of a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.html`. | | [Pipe.SourceChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.SourceChannel.html) | A channel representing the readable end of a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.html`. | | [PipedInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PipedInputStream.html) | Receives information from a communications pipe. | | [PipedOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PipedOutputStream.html) | Places information on a communications pipe. | | [PipedReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PipedReader.html) | Piped character-input streams. | | [PipedWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PipedWriter.html) | Piped character-output streams. | | [PreparedStatement](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/PreparedStatement.html) | An object that represents a precompiled SQL statement. | | [PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) | A `PrintStream` adds functionality to another output stream, namely the ability to print representations of various data values conveniently. | | [PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) | Prints formatted representations of objects to a text-output stream. | | [PushbackInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PushbackInputStream.html) | A `PushbackInputStream` adds functionality to another input stream, namely the ability to "push back" or "unread" one byte. | | [PushbackReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PushbackReader.html) | A character-stream reader that allows characters to be pushed back into the stream. | | [RandomAccessFile](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/RandomAccessFile.html) | Instances of this class support both reading and writing to a random access file. | | [ReadableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ReadableByteChannel.html) | A channel that can read bytes. | | [Reader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Reader.html) | Abstract class for reading character streams. | | [ResultSet](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/ResultSet.html) | A table of data representing a database result set, which is usually generated by executing a statement that queries the database. | | [RowSet](https://developers.google.com/j2objc/javadoc/jre/reference/javax/sql/RowSet.html) | The interface that adds support to the JDBC API for the JavaBeans^TM^ component model. | | [SSLServerSocket](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLServerSocket.html) | This class extends `ServerSocket`s and provides secure server sockets using protocols such as the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols. | | [SSLSocket](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSocket.html) | This class extends `Socket`s and provides secure socket using protocols such as the "Secure Sockets Layer" (SSL) or IETF "Transport Layer Security" (TLS) protocols. | | [Scanner](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Scanner.html) | A simple text scanner which can parse primitive types and strings using regular expressions. | | [ScatteringByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ScatteringByteChannel.html) | A channel that can read bytes into a sequence of buffers. | | [SecureDirectoryStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/SecureDirectoryStream.html)\<T\> | A `DirectoryStream` that defines operations on files that are located relative to an open directory. | | [SeekableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SeekableByteChannel.html) | A byte channel that maintains a current *position* and allows the position to be changed. | | [SelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SelectableChannel.html) | A channel that can be multiplexed via a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Selector.html`. | | [Selector](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Selector.html) | A multiplexor of `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SelectableChannel.html` objects. | | [SequenceInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/SequenceInputStream.html) | A `SequenceInputStream` represents the logical concatenation of other input streams. | | [ServerSocket](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/ServerSocket.html) | This class implements server sockets. | | [ServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ServerSocketChannel.html) | A selectable channel for stream-oriented listening sockets. | | [Socket](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/Socket.html) | This class implements client sockets (also called just "sockets"). | | [SocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SocketChannel.html) | A selectable channel for stream-oriented connecting sockets. | | [Statement](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/Statement.html) | The object used for executing a static SQL statement and returning the results it produces. | | [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<T\> | A sequence of elements supporting sequential and parallel aggregate operations. | | [StringBufferInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/StringBufferInputStream.html) | *This class is deprecated. This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the `StringReader` class.* | | [StringReader](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/StringReader.html) | A character stream whose source is a string. | | [StringWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/StringWriter.html) | A character stream that collects its output in a string buffer, which can then be used to construct a string. | | [WatchService](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/WatchService.html) | A watch service that *watches* registered objects for changes and events. | | [WritableByteChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/WritableByteChannel.html) | A channel that can write bytes. | | [Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html) | Abstract class for writing to character streams. | | [ZipFile](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipFile.html) | This class is used to read entries from a zip file. | | [ZipInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipInputStream.html) | This class implements an input stream filter for reading files in the ZIP file format. | | [ZipOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/ZipOutputStream.html) | This class implements an output stream filter for writing files in the ZIP file format. | |||

An object that may hold resources (such as file or socket handles)
until it is closed. The `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close()` method of an `AutoCloseable`
object is called automatically when exiting a `try`-with-resources block for which the object has been declared in
the resource specification header. This construction ensures prompt
release, avoiding resource exhaustion exceptions and errors that
may otherwise occur.

### Public Method Summary

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Public Methods

#### public abstract void
**close**
()

Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
`try`-with-resources statement.

While this interface method is declared to throw `Exception`, implementers are *strongly* encouraged to
declare concrete implementations of the `close` method to
throw more specific exceptions, or to throw no exception at all
if the close operation cannot fail.

Cases where the close operation may fail require careful
attention by implementers. It is strongly advised to relinquish
the underlying resources and to internally *mark* the
resource as closed, prior to throwing the exception. The `close` method is unlikely to be invoked more than once and so
this ensures that the resources are released in a timely manner.
Furthermore it reduces problems that could arise when the resource
wraps, or is wrapped, by another resource.

*Implementers of this interface are also strongly advised
to not have the `close` method throw `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html`.*

This exception interacts with a thread's interrupted status,
and runtime misbehavior is likely to occur if an `InterruptedException` is {@linkplain Throwable#addSuppressed
suppressed}.

More generally, if it would cause problems for an
exception to be suppressed, the `AutoCloseable.close`
method should not throw it.

Note that unlike the `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html#close()`
method of `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html`, this `close` method
is *not* required to be idempotent. In other words,
calling this `close` method more than once may have some
visible side effect, unlike `Closeable.close` which is
required to have no effect if called more than once.

However, implementers of this interface are strongly encouraged
to make their `close` methods idempotent.

##### Throws

| [Exception](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Exception.html) | if this resource cannot be closed |
|---|---|