Interface IOSupplier<T>
-
- Type Parameters:
T- the type of the supplied value
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface IOSupplier<T>
Represents a supplier that may throw anIOException.This is a functional interface that can be used as a safety wrapper for operations that supply values and may trigger I/O exceptions.
- Since:
- 4.0.0
- Author:
- Dmytro Nosan
- See Also:
wrap(Supplier)
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Tget()Supplies a value, potentially throwing anIOException.static <T> IOSupplier<T>wrap(Supplier<? extends T> supplier)Wraps the givenSupplierinto anIOSupplier.
-
-
-
Method Detail
-
wrap
static <T> IOSupplier<T> wrap(Supplier<? extends T> supplier)
Wraps the givenSupplierinto anIOSupplier.This method adapts a standard Java
Supplierinto anIOSupplier. The originalSupplier'sSupplier.get()method is used as the implementation.- Type Parameters:
T- The type of the supplied value- Parameters:
supplier- The original supplier to be wrapped- Returns:
- A new
IOSupplierwrapping the provided supplier - Throws:
NullPointerException- if the supplier isnull
-
get
T get() throws IOException
Supplies a value, potentially throwing anIOException.- Returns:
- The supplied value
- Throws:
IOException- If an I/O error occurs
-
-