Class Close

java.lang.Object
com.globalmentor.io.Close

public class Close extends Object
Utility factory class for creating Closeable instances.
Author:
Garret Wilson
  • Constructor Details

    • Close

      public Close()
  • Method Details

    • by

      public static 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:
      NullPointerException - if the optional is null; or if the value is present but the consumer is null.