public final class DiggIO extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends AutoCloseable> |
autoClosing(ThrowingConsumer<T,? extends Exception> consumer)
Wrap a consumer which processes an
AutoCloseable
(typically an InputStream or similar) into a new Consumer which will always close
the AutoCloseable when the given consumer returns, successfully or throwing an exception. |
static <T extends AutoCloseable,R> |
autoClosing(ThrowingFunction<T,R,? extends Exception> function)
Wrap a function which yields a result from processing an
AutoCloseable
(typically an InputStream or similar) into a new Function which will always close
the AutoCloseable when the given function returns, successfully or throwing an exception. |
public static <T extends AutoCloseable> Consumer<T> autoClosing(ThrowingConsumer<T,? extends Exception> consumer)
AutoCloseable
(typically an InputStream or similar) into a new Consumer which will always close
the AutoCloseable when the given consumer returns, successfully or throwing an exception.consumer - the ThrowingConsumer taking an AutoCloseable as argument.Consumer which will handle closing of the passed AutoCloseable.public static <T extends AutoCloseable,R> Function<T,R> autoClosing(ThrowingFunction<T,R,? extends Exception> function)
AutoCloseable
(typically an InputStream or similar) into a new Function which will always close
the AutoCloseable when the given function returns, successfully or throwing an exception.function - the ThrowingFunction taking an AutoCloseable as argument.Function which will handle closing of the passed AutoCloseable.Copyright © 2016 Digipost. All rights reserved.