Class Close


  • public class Close
    extends java.lang.Object
    Utility factory class for creating Closeable instances.
    Author:
    Garret Wilson
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Close.Strategy
      A strategy for closing.
    • Constructor Summary

      Constructors 
      Constructor Description
      Close()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.Closeable by​(Close.Strategy closeStragy)
      Produces a Closeable object that will close by invoking the given consumer.
      • Methods inherited from class java.lang.Object

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

      • Close

        public Close()
    • Method Detail

      • by

        public static java.io.Closeable by​(@Nonnull
                                           Close.Strategy closeStragy)
        Produces a Closeable object that will close by invoking the given consumer.
        Parameters:
        closeStragy - The strategy for closing the returned Closeable.
        Returns:
        A Closeable instance that will invoke the given close strategy when closed.
        Throws:
        java.lang.NullPointerException - if the optional is null; or if the value is present but the consumer is null.