public interface NonThrowingCloseable extends Closeable
Closeable which cannot throw a checked exception.
This is useful because such a reversion otherwise requires the caller to catch the (impossible) Exception in the try-with-resources.
Example of usage:
try (NonThrowingAutoCloseable ctx = tryEnter()) {
...
}
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void close()
close in interface AutoCloseableclose in interface Closeable