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