Class Utils
- java.lang.Object
-
- org.apache.flink.connector.file.src.util.Utils
-
@PublicEvolving public final class Utils extends Object
Miscellaneous utilities for the file source.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> E
doWithCleanupOnException(Closeable toCleanUp, SupplierWithException<E,IOException> code)
Runs the givenSupplierWithException
(a piece of code producing a result).static void
doWithCleanupOnException(Closeable toCleanUp, ThrowingRunnable<IOException> code)
Runs the givenRunnable
.static <T> void
forEachRemaining(BulkFormat.Reader<T> reader, Consumer<? super T> action)
Performs the given action for each remaining element inBulkFormat.Reader
until all elements have been processed or the action throws an exception.
-
-
-
Method Detail
-
doWithCleanupOnException
public static <E> E doWithCleanupOnException(Closeable toCleanUp, SupplierWithException<E,IOException> code) throws IOException
Runs the givenSupplierWithException
(a piece of code producing a result). If an exception happens during that, the given closable is quietly closed.- Throws:
IOException
-
doWithCleanupOnException
public static void doWithCleanupOnException(Closeable toCleanUp, ThrowingRunnable<IOException> code) throws IOException
Runs the givenRunnable
. If an exception happens during that, the given closable is quietly closed.- Throws:
IOException
-
forEachRemaining
public static <T> void forEachRemaining(BulkFormat.Reader<T> reader, Consumer<? super T> action) throws IOException
Performs the given action for each remaining element inBulkFormat.Reader
until all elements have been processed or the action throws an exception.- Throws:
IOException
-
-