@PublicEvolving public final class Utils extends Object
Modifier and Type | Method and Description |
---|---|
static <E> E |
doWithCleanupOnException(Closeable toCleanUp,
SupplierWithException<E,IOException> code)
Runs the given
SupplierWithException (a piece of code producing a result). |
static void |
doWithCleanupOnException(Closeable toCleanUp,
ThrowingRunnable<IOException> code)
Runs the given
Runnable . |
static <T> void |
forEachRemaining(BulkFormat.Reader<T> reader,
java.util.function.Consumer<? super T> action)
Performs the given action for each remaining element in
BulkFormat.Reader until all
elements have been processed or the action throws an exception. |
public static <E> E doWithCleanupOnException(Closeable toCleanUp, SupplierWithException<E,IOException> code) throws IOException
SupplierWithException
(a piece of code producing a result). If an
exception happens during that, the given closable is quietly closed.IOException
public static void doWithCleanupOnException(Closeable toCleanUp, ThrowingRunnable<IOException> code) throws IOException
Runnable
. If an exception happens during that, the given closable is
quietly closed.IOException
public static <T> void forEachRemaining(BulkFormat.Reader<T> reader, java.util.function.Consumer<? super T> action) throws IOException
BulkFormat.Reader
until all
elements have been processed or the action throws an exception.IOException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.