public class IOUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
IOUtil.Lazy
Lazy evaluation for logging complex objects
|
static class |
IOUtil.OctetBody
Wrapper for an
OCTET request body |
static interface |
IOUtil.SilentSupplier<T>
Supplier that can throw checked-exceptions
|
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY_BYTES
Empty byte-array, used for
readAllBytes(java.io.InputStream) |
static okhttp3.MediaType |
JSON
application/json
|
static okhttp3.MediaType |
OCTET
application/octet-stream
|
| Constructor and Description |
|---|
IOUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> @NotNull java.util.concurrent.CompletableFuture<java.util.List<T>> |
flipFuture(@NotNull java.util.List<java.util.concurrent.CompletableFuture<T>> list)
Converts a list of futures in a future of a list.
|
static @Nullable java.io.InputStream |
getBody(okhttp3.Response req)
Helper method which handles gzip encoded response bodies
|
static @NotNull byte[] |
readAllBytes(@NotNull java.io.InputStream stream)
Reads all bytes from an
InputStream |
static @NotNull org.json.JSONObject |
toJSON(@NotNull java.io.InputStream input)
Converts an
InputStream to a JSONObject |
public static final okhttp3.MediaType JSON
public static final okhttp3.MediaType OCTET
public static final byte[] EMPTY_BYTES
readAllBytes(java.io.InputStream)@NotNull
public static @NotNull byte[] readAllBytes(@NotNull
@NotNull java.io.InputStream stream)
throws java.io.IOException
InputStreamstream - The InputStreambyte[] containing all bytes of the streamjava.io.IOException - If some I/O error occurs@Nullable
public static @Nullable java.io.InputStream getBody(@NotNull
okhttp3.Response req)
throws java.io.IOException
req - Response instanceInputStream representing the response bodyjava.io.IOException - If some I/O error occurs@NotNull
public static @NotNull org.json.JSONObject toJSON(@NotNull
@NotNull java.io.InputStream input)
InputStream to a JSONObjectinput - The InputStreamJSONObject for the provided inputorg.json.JSONException - If parsing fails@NotNull
public static <T> @NotNull java.util.concurrent.CompletableFuture<java.util.List<T>> flipFuture(@NotNull
@NotNull java.util.List<java.util.concurrent.CompletableFuture<T>> list)
T - Component type of the listlist - The list of futures to flatten