Interface SafeCloseable
- All Superinterfaces:
AutoCloseable
,Closeable
A
Closeable
which does not throw IOExceptions
. This enables the try-close-pattern without
catching of exceptions.- See Also:
Closeable
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Same asCloseable.close()
but it is not allowed to throw anIOException
.static SafeCloseable
Wraps the givenCloseable
into aSafeCloseable
which logs and prints thestacktrace
of the thrownIOException
.
-
Method Details
-
safe
Wraps the givenCloseable
into aSafeCloseable
which logs and prints thestacktrace
of the thrownIOException
.- Parameters:
closeable
-Closeable
to be wrapped- Returns:
- new
SafeCloseable
from the givenCloseable
-
close
void close()Same asCloseable.close()
but it is not allowed to throw anIOException
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-