public class AutoCloseables extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
AutoCloseables.Closeable |
| Constructor and Description |
|---|
AutoCloseables() |
| Modifier and Type | Method and Description |
|---|---|
static AutoCloseable |
all(Collection<? extends AutoCloseable> autoCloseables) |
static void |
close(AutoCloseable... autoCloseables)
Closes all autoCloseables if not null and suppresses subsequent exceptions if more than one
|
static void |
close(Iterable<? extends AutoCloseable> autoCloseables)
Closes all autoCloseables if not null and suppresses subsequent exceptions if more than one
|
static void |
close(Throwable t,
AutoCloseable... autoCloseables)
Closes all autoCloseables if not null and suppresses exceptions by adding them to t
|
static void |
close(Throwable t,
Collection<? extends AutoCloseable> autoCloseables)
Closes all autoCloseables if not null and suppresses exceptions by adding them to t
|
static void |
closeSilently(AutoCloseable... closeables)
Close all without caring about thrown exceptions
|
static void |
closeWithUserException(AutoCloseable... autoCloseables) |
public static AutoCloseable all(Collection<? extends AutoCloseable> autoCloseables)
public static void close(Throwable t, AutoCloseable... autoCloseables)
t - the throwable to add suppressed exception toautoCloseables - the closeables to closepublic static void close(Throwable t, Collection<? extends AutoCloseable> autoCloseables)
t - the throwable to add suppressed exception toautoCloseables - the closeables to closepublic static void close(AutoCloseable... autoCloseables) throws Exception
autoCloseables - the closeables to closeExceptionpublic static void closeWithUserException(AutoCloseable... autoCloseables)
public static void close(Iterable<? extends AutoCloseable> autoCloseables) throws Exception
autoCloseables - the closeables to closeExceptionpublic static void closeSilently(AutoCloseable... closeables)
closeables - array containing auto closeablesCopyright © 2021 The Apache Software Foundation. All rights reserved.