public class RXUtils extends Object
| Constructor and Description |
|---|
RXUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> retrofit2.Response<T> |
ensureSuccessResponse(retrofit2.Response<T> response) |
static <T> T |
getResponseBody(retrofit2.Response<T> response) |
static <T> io.reactivex.Observable<Indexed<T>> |
mapWithIndex(io.reactivex.Observable<T> observable)
Adds an index to each emitted item in an observable, starting from 0.
|
static <T> io.reactivex.Observable<Indexed<T>> |
mapWithIndex(io.reactivex.Observable<T> observable,
int startFrom)
Adds an index to each emitted item in an observable.
|
static io.reactivex.Single<byte[]> |
readFile(String path)
Reads a file and emits its content.
|
static io.reactivex.Observable<byte[]> |
readFileChunks(String path,
int maxChunkSize)
Reads a file into chunks and emits them through an Observable.
|
public static <T> io.reactivex.Observable<Indexed<T>> mapWithIndex(io.reactivex.Observable<T> observable, int startFrom)
T - the type of emitted itemsobservable - original observablestartFrom - starting indexpublic static <T> io.reactivex.Observable<Indexed<T>> mapWithIndex(io.reactivex.Observable<T> observable)
T - the type of emitted itemsobservable - original observablepublic static <T> retrofit2.Response<T> ensureSuccessResponse(retrofit2.Response<T> response)
throws HttpResponseException
HttpResponseExceptionpublic static <T> T getResponseBody(retrofit2.Response<T> response)
throws HttpResponseException
HttpResponseExceptionpublic static io.reactivex.Observable<byte[]> readFileChunks(String path, int maxChunkSize)
path - path to the filemaxChunkSize - maximum chunk size in bytespublic static io.reactivex.Single<byte[]> readFile(String path)
path - path to the fileCopyright © 2024. All rights reserved.