Class Utils

Object
io.delta.kernel.internal.util.Utils

@Evolving public class Utils extends Object
Various utility methods to help the connectors work with data objects returned by Kernel
Since:
3.0.0
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • singletonCloseableIterator

      public static <T> CloseableIterator<T> singletonCloseableIterator(T elem)
      Utility method to create a singleton CloseableIterator.
      Type Parameters:
      T - Element type.
      Parameters:
      elem - Element to create iterator with.
      Returns:
      A CloseableIterator with just one element.
    • toCloseableIterator

      public static <T> CloseableIterator<T> toCloseableIterator(Iterator<T> iter)
      Convert a Iterator to CloseableIterator. Useful when passing normal iterators for arguments that require CloseableIterator type.
      Type Parameters:
      T - Element type
      Parameters:
      iter - Iterator instance
      Returns:
      A CloseableIterator wrapping the given Iterator
    • closeCloseables

      public static void closeCloseables(AutoCloseable... closeables)
      Close the given one or more AutoCloseables. AutoCloseable.close() will be called on all given non-null closeables. Will throw unchecked RuntimeException if an error occurs while closing. If multiple closeables causes exceptions in closing, the exceptions will be added as suppressed to the main exception that is thrown.
      Parameters:
      closeables -
    • closeCloseablesSilently

      public static void closeCloseablesSilently(AutoCloseable... closeables)
      Close the given list of AutoCloseable objects. Any exception thrown is silently ignored.
      Parameters:
      closeables -