public final class Checked extends Object
Instead of
OutputStream os = ...; Observable<String> source = ...; source.doOnNext(s -> { try { os.write(s.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } }) .subscribe();
you can write:
source.doOnNext(Checked.a1(s -> os.write(s.getBytes()))).subscribe();
Modifier and Type | Class and Description |
---|---|
static interface |
Checked.A0 |
static interface |
Checked.A1<T> |
static interface |
Checked.A2<T,R> |
static interface |
Checked.F0<T> |
static interface |
Checked.F1<T,R> |
static interface |
Checked.F2<T,R,S> |
Constructor and Description |
---|
Checked() |
Modifier and Type | Method and Description |
---|---|
static rx.functions.Action0 |
a0(Checked.A0 a) |
static <T> rx.functions.Action1<T> |
a1(Checked.A1<T> a) |
static <T,R> rx.functions.Action2<T,R> |
a2(Checked.A2<T,R> a) |
static <T> rx.functions.Func0<T> |
f0(Checked.F0<T> f)
Returns a
Func0 that reports any exception thrown by f wrapped by
a RuntimeException . |
static <T,R> rx.functions.Func1<T,R> |
f1(Checked.F1<T,R> f) |
static <T,R,S> rx.functions.Func2<T,R,S> |
f2(Checked.F2<T,R,S> f) |
public static <T> rx.functions.Func0<T> f0(Checked.F0<T> f)
Func0
that reports any exception thrown by f wrapped by
a RuntimeException
.T
- type parameterf
- has same signature as Func0 but can throw an exceptionFunc0
that reports any exception thrown by f wrapped by
a RuntimeException
.public static <T,R> rx.functions.Func1<T,R> f1(Checked.F1<T,R> f)
public static <T,R,S> rx.functions.Func2<T,R,S> f2(Checked.F2<T,R,S> f)
public static rx.functions.Action0 a0(Checked.A0 a)
public static <T> rx.functions.Action1<T> a1(Checked.A1<T> a)
public static <T,R> rx.functions.Action2<T,R> a2(Checked.A2<T,R> a)
Copyright © 2013–2016. All rights reserved.