Class CloserUtil

java.lang.Object
htsjdk.samtools.util.CloserUtil

public class CloserUtil extends Object
Utility to close things that implement Closeable WARNING: This should only be used for Closeable things open for read, because it ignores exceptions, and the caller will probably want to know about exceptions when closing a file being written to, because this may indicate a failure to flush.
  • Constructor Details

    • CloserUtil

      public CloserUtil()
  • Method Details

    • close

      public static void close(Object obj)
      Calls close() on obj if it implements Closeable
      Parameters:
      obj - The potentially closeable object
    • close

      public static void close(List<? extends Object> objs)
      Calls close() on all elements of objs that implement Closeable
      Parameters:
      objs - A list of potentially closeable objects NOTE: This method must take a List<? extends Object>, not List, otherwise the overload above will be selected if the argument is not exactly List.