Class Utils


  • @PublicEvolving
    public final class Utils
    extends Object
    Miscellaneous utilities for the file source.
    • Method Detail

      • 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