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 TypeMethodDescriptionvoidclose()Same asCloseable.close()but it is not allowed to throw anIOException.static SafeCloseableWraps the givenCloseableinto aSafeCloseablewhich logs and prints thestacktraceof the thrownIOException.
-
Method Details
-
safe
Wraps the givenCloseableinto aSafeCloseablewhich logs and prints thestacktraceof the thrownIOException.- Parameters:
closeable-Closeableto be wrapped- Returns:
- new
SafeCloseablefrom the givenCloseable
-
close
void close()Same asCloseable.close()but it is not allowed to throw anIOException.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-