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 anAutoCloseableand logs the exception from closing. 
- 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedQuiet(C wrapped, Logger logger)Creates a new unconditional closeable wrapping the designatedAutoCloseablelogging or wrapping any exception fromAutoCloseable.close().protectedQuiet(Supplier<Boolean> condition, C wrapped, Logger logger)Creates a new conditional closeable wrapping the designatedAutoCloseablelogging or wrapping any exception fromAutoCloseable.close(). 
 - 
 
- 
- 
Field Detail
- 
logger
protected final Logger logger
The logger to which to log an occurred exception ornullto wrap the exception asRuntimeException. 
 - 
 
- 
Constructor Detail
- 
Quiet
protected Quiet(C wrapped, Logger logger)
Creates a new unconditional closeable wrapping the designatedAutoCloseablelogging or wrapping any exception fromAutoCloseable.close().- Parameters:
 wrapped- The wrappedAutoCloseable.logger- The logger to which to log an occurred exception ornullto wrap the exception asRuntimeException.
 
- 
Quiet
protected Quiet(Supplier<Boolean> condition, C wrapped, Logger logger)
Creates a new conditional closeable wrapping the designatedAutoCloseablelogging or wrapping any exception fromAutoCloseable.close().- Parameters:
 condition- The optional condition allowing for conditional closing ornullfor unconditional closing.wrapped- The wrappedAutoCloseable.logger- The logger to which to log an occurred exception ornullto wrap the exception asRuntimeException.
 
 - 
 
 -