Class AutoClosableUtils


  • public final class AutoClosableUtils
    extends java.lang.Object
    Utilities for AutoCloseable.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeAndReThrowIoException​(java.lang.AutoCloseable closeable)
      Call AutoCloseable.close() and re-throw any exceptions as a IOException.
      static void closeAndReThrowUnchecked​(java.lang.AutoCloseable closeable)
      Call AutoCloseable.close() and re-throw any exceptions as an unchecked exception.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • closeAndReThrowUnchecked

        public static void closeAndReThrowUnchecked​(java.lang.AutoCloseable closeable)
        Call AutoCloseable.close() and re-throw any exceptions as an unchecked exception.
        Parameters:
        closeable - The object to close.
      • closeAndReThrowIoException

        public static void closeAndReThrowIoException​(java.lang.AutoCloseable closeable)
                                               throws java.io.IOException
        Call AutoCloseable.close() and re-throw any exceptions as a IOException.
        Parameters:
        closeable - The object to close.
        Throws:
        java.io.IOException - if an exception occurs during AutoCloseable.close().