Class Closer
- java.lang.Object
-
- org.apache.logging.log4j.core.util.Closer
-
public final class Closer extends Object
Helper class for closing resources.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(AutoCloseable closeable)
Closes an AutoCloseable or ignores ifnull
.static boolean
closeSilently(AutoCloseable closeable)
Closes an AutoCloseable and returnstrue
if it closed without exception.
-
-
-
Method Detail
-
close
public static void close(AutoCloseable closeable) throws Exception
Closes an AutoCloseable or ignores ifnull
.- Parameters:
closeable
- the resource to close; may be null- Throws:
Exception
- if the resource cannot be closed- Since:
- 2.8
-
closeSilently
public static boolean closeSilently(AutoCloseable closeable)
Closes an AutoCloseable and returnstrue
if it closed without exception.- Parameters:
closeable
- the resource to close; may be null- Returns:
- true if resource was closed successfully, or false if an exception was thrown
-
-