public final class Closeables extends Object
Modifier and Type | Method and Description |
---|---|
static <E extends Exception> |
close(Iterable<? extends GenericCloseable<? extends E>> closeables)
Close multiple resources, ensuring that all resources get closed
even if one of them throws a Throwable.
|
static void |
closeQuietly(Closeable resource)
Close a resource without throwing an exception.
|
static void |
closeQuietly(Iterable<? extends Closeable>... resourceIterables)
Close resources without throwing an exception.
|
public static <E extends Exception> void close(Iterable<? extends GenericCloseable<? extends E>> closeables) throws E extends Exception
The first caught throwable will be re-thrown, and any additional
throwable will be suppressed
.
closeables
- The resources to closeE
- if a closeable throws such an exceptionE extends Exception
public static void closeQuietly(Closeable resource)
resource
- the resource to close@SafeVarargs public static void closeQuietly(Iterable<? extends Closeable>... resourceIterables)
resourceIterables
- the iterables containing the resources to closeCopyright © 2006-2017 Red Hat, Inc. All Rights Reserved