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 Details

    • doWithCleanupOnException

      public static <E> E doWithCleanupOnException(Closeable toCleanUp, org.apache.flink.util.function.SupplierWithException<E,IOException> code) throws IOException
      Runs the given SupplierWithException (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 given Runnable. 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 in BulkFormat.Reader until all elements have been processed or the action throws an exception.
      Throws:
      IOException