Class CloseUtil

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class CloseUtil
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Convenient way to collect closables and close them at once. Handles Exceptions and null objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      CloseUtil()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CloseUtil add​(java.lang.AutoCloseable closeable)  
      void close()  
      static void close​(java.lang.AutoCloseable closable)  
      • Methods inherited from class java.lang.Object

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

      • CloseUtil

        public CloseUtil()
    • Method Detail

      • add

        public CloseUtil add​(java.lang.AutoCloseable closeable)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • close

        public static void close​(java.lang.AutoCloseable closable)