Class Closer
- java.lang.Object
-
- org.apache.logging.log4j.core.util.Closer
-
public final class Closer extends java.lang.ObjectCloses resources.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateCloser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanclose(java.lang.AutoCloseable closeable)Closes an AutoCloseable or ignores ifnull.static booleancloseSilently(java.lang.AutoCloseable closeable)Closes an AutoCloseable and returnstrueif it closed without exception.
-
-
-
Method Detail
-
close
public static boolean close(java.lang.AutoCloseable closeable) throws java.lang.ExceptionCloses an AutoCloseable or ignores ifnull.- Parameters:
closeable- the resource to close; may be null- Returns:
- Whether the resource was closed.
- Throws:
java.lang.Exception- if the resource cannot be closed- Since:
- 2.8, 2.11.2 returns a boolean instead of being a void return type.
-
closeSilently
public static boolean closeSilently(java.lang.AutoCloseable closeable)
Closes an AutoCloseable and returnstrueif 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
-
-