Class Utils
java.lang.Object
org.apache.flink.connector.file.src.util.Utils
Miscellaneous utilities for the file source.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> EdoWithCleanupOnException(Closeable toCleanUp, org.apache.flink.util.function.SupplierWithException<E, IOException> code) Runs the givenSupplierWithException(a piece of code producing a result).static voiddoWithCleanupOnException(Closeable toCleanUp, org.apache.flink.util.function.ThrowingRunnable<IOException> code) Runs the givenRunnable.static <T> voidforEachRemaining(BulkFormat.Reader<T> reader, Consumer<? super T> action) Performs the given action for each remaining element inBulkFormat.Readeruntil all elements have been processed or the action throws an exception.
-
Method Details
-
doWithCleanupOnException
public static <E> E doWithCleanupOnException(Closeable toCleanUp, org.apache.flink.util.function.SupplierWithException<E, IOException> code) throws IOExceptionRuns 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, org.apache.flink.util.function.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.Readeruntil all elements have been processed or the action throws an exception.- Throws:
IOException
-