Skip to content

Most visited

Recently visited

navigation
Added in API level 19

AutoCloseable

public interface AutoCloseable

java.lang.AutoCloseable
Known Indirect Subclasses


Defines an interface for classes that can (or need to) be closed once they are not used any longer. Calling the close method releases resources that the object holds.

A common pattern for using an AutoCloseable resource:

   Closable foo = new Foo();
   try {
      ...;
    finally {
      foo.close();
   }
 }

Summary

Public methods

abstract void close()

Closes the object and release any system resources it holds.

Public methods

close

Added in API level 19
void close ()

Closes the object and release any system resources it holds.

Throws
Exception
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.