public class Closer extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOGGER |
| Constructor and Description |
|---|
Closer() |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(Closeable closeable)
Closes the given
Closeable and logs occuring exceptions with the
Logger of this utility class. |
static void |
close(Closeable closeable,
org.slf4j.Logger logger)
Closes the given
Closeable and logs occuring exceptions with the
given Logger. |
static void |
close(Closeable closeable,
org.slf4j.Logger logger,
boolean withStackTrace)
Closes the given
Closeable and logs occuring exceptions with the
given Logger. |
static void |
closeQuietly(Closeable closeable)
Closes the given
Closeable while ignoring all exception that may
occur. |
public static void closeQuietly(Closeable closeable)
Closeable while ignoring all exception that may
occur.closeable - the object which should be closed.public static void close(Closeable closeable)
Closeable and logs occuring exceptions with the
Logger of this utility class.
Note that it is recommended to use close(Closeable, Logger)
instead.closeable - the object which should be closed.public static void close(Closeable closeable, org.slf4j.Logger logger)
Closeable and logs occuring exceptions with the
given Logger.
Note that exceptions are logged without their stack trace (i.e., like
you would call close(Closeable, Logger, boolean) with false
for the stack trace flag.closeable - the object which should be closed.logger - the logger used for logging occurring exceptionspublic static void close(Closeable closeable, org.slf4j.Logger logger, boolean withStackTrace)
Closeable and logs occuring exceptions with the
given Logger. Depending on the given flag, exceptions are logged with
their stack trace or not.closeable - the object which should be closed.logger - the logger used for logging occurring exceptionswithStackTrace - if this flag is true the exception will be logged together
with its stack trace. Otherwise, only the exception message will
be logged.Copyright © 2017–2019. All rights reserved.