public final class IOUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends AutoCloseable,E extends Throwable> |
closeAll(Class<E> throwableClass,
T... closeables)
Close all given closeables and if something goes wrong throw exception of the given type.
|
static <T extends AutoCloseable> |
closeAll(Collection<T> closeables)
Closes given
collection of closeables. |
static <T extends AutoCloseable> |
closeAll(T... closeables)
Closes given array of
closeables. |
static <T extends AutoCloseable> |
closeAllSilently(Collection<T> closeables)
Closes given
collection of closeables ignoring all exceptions. |
static <T extends AutoCloseable> |
closeAllSilently(T... closeables)
Closes given array of
closeables ignoring all exceptions. |
public static <T extends AutoCloseable> void closeAll(Collection<T> closeables) throws IOException
collection of closeables.T - the type of closeablecloseables - the closeables to closeIOExceptioncloseAll(AutoCloseable[])public static <T extends AutoCloseable> void closeAllSilently(Collection<T> closeables)
collection of closeables ignoring all exceptions.T - the type of closeablecloseables - the closeables to closecloseAll(AutoCloseable[])@SafeVarargs public static <T extends AutoCloseable> void closeAll(T... closeables) throws IOException
closeables. If any AutoCloseable.close() call throws
IOException than it will be rethrown to the caller after calling AutoCloseable.close()
on other given resources. If more than one AutoCloseable.close() throw than resulting exception will
have suppressed exceptions. See Throwable.addSuppressed(Throwable)T - the type of closeablecloseables - the closeables to closeIOException@SafeVarargs public static <T extends AutoCloseable> void closeAllSilently(T... closeables)
closeables ignoring all exceptions.T - the type of closeablecloseables - the closeables to close@SafeVarargs public static <T extends AutoCloseable,E extends Throwable> void closeAll(Class<E> throwableClass, T... closeables) throws E extends Throwable
String and Throwable like
RuntimeException.RuntimeException(String, Throwable)T - the type of closeableE - the type of exceptionthrowableClass - exception type to throw in case of failurecloseables - the closeables to closeE - when any AutoCloseable.close() throws exceptionE extends ThrowableCopyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.