Package com.globalmentor.io
Class Close
- java.lang.Object
-
- com.globalmentor.io.Close
-
public class Close extends java.lang.Object
Utility factory class for creatingCloseable
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 aCloseable
object that will close by invoking the given consumer.
-
-
-
Method Detail
-
by
public static java.io.Closeable by(@Nonnull Close.Strategy closeStragy)
Produces aCloseable
object that will close by invoking the given consumer.- Parameters:
closeStragy
- The strategy for closing the returnedCloseable
.- Returns:
- A
Closeable
instance that will invoke the given close strategy when closed. - Throws:
java.lang.NullPointerException
- if the optional isnull
; or if the value is present but the consumer isnull
.
-
-