Package de.aristaflow.adept2.util.io
Class IoTools.Quiet<C extends AutoCloseable>
- java.lang.Object
-
- de.aristaflow.adept2.util.io.IoTools.Quiet<C>
-
- Type Parameters:
C
- The type of the closeable of which to log any exception fromAutoCloseable.close()
.
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- IoTools
public static class IoTools.Quiet<C extends AutoCloseable> extends Object
This class wraps anAutoCloseable
and logs the exception from closing.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Quiet(C wrapped, Logger logger)
Creates a new closeable wrapping the designatedAutoCloseable
logging or wrapping any exception fromAutoCloseable.close()
.
-
-
-
Field Detail
-
logger
protected final Logger logger
The logger to which to log an occurred exception ornull
to wrap the exception asRuntimeException
.
-
-
Constructor Detail
-
Quiet
protected Quiet(C wrapped, Logger logger)
Creates a new closeable wrapping the designatedAutoCloseable
logging or wrapping any exception fromAutoCloseable.close()
.- Parameters:
wrapped
- The wrappedAutoCloseable
.logger
- The logger to which to log an occurred exception ornull
to wrap the exception asRuntimeException
.
-
-