Class IoUtils

java.lang.Object
ca.uhn.fhir.util.IoUtils

public class IoUtils extends Object
  • Method Details

    • closeQuietly

      public static void closeQuietly(AutoCloseable theCloseable)
      Replacement for the deprecated commons-lang method of the same name. Use sparingly since they are right that most uses of this should be replaced with try-with-resources
    • closeQuietly

      public static void closeQuietly(AutoCloseable theCloseable, org.slf4j.Logger theLog)
      Closes quietly logging exceptions if any
      Parameters:
      theCloseable - Closeable instance to be closed
      theLog - Logger to log a potential exception
    • safeCast

      public static <T> Optional<T> safeCast(Object theObject, Class<T> theTargetClass)
      Cast the object to the target class, returning an empty optional if it fails.