public class HttpConnectionUtility
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
processRequest(@NotNull java.lang.String userAgent,
@NotNull java.lang.String urlString,
java.util.function.Function<java.io.InputStreamReader,T> function)
Requests an
InputStreamReader from a URL and returns the result of the specified function |
static @Nullable com.google.gson.JsonElement |
requestJson(@NotNull java.lang.String userAgent,
@NotNull java.lang.String urlString)
Retrieves the
JsonElement from the specified URL |
static @Nullable java.lang.String |
requestString(@NotNull java.lang.String userAgent,
@NotNull java.lang.String urlString)
Requests a
String from a URL |
@Nullable
public static <T> T processRequest(@NotNull
@NotNull java.lang.String userAgent,
@NotNull
@NotNull java.lang.String urlString,
java.util.function.Function<java.io.InputStreamReader,T> function)
InputStreamReader from a URL and returns the result of the specified functionT - the type of the result of the specified functionuserAgent - the user agent to useurlString - the URL to request fromfunction - the function to apply to the InputStreamReader@Nullable
public static @Nullable java.lang.String requestString(@NotNull
@NotNull java.lang.String userAgent,
@NotNull
@NotNull java.lang.String urlString)
String from a URLuserAgent - the user agent to useurlString - the URL to request fromString, or null if the request failed@Nullable
public static @Nullable com.google.gson.JsonElement requestJson(@NotNull
@NotNull java.lang.String userAgent,
@NotNull
@NotNull java.lang.String urlString)
JsonElement from the specified URLuserAgent - the user agent to use when retrieving the JsonElementurlString - the URL to retrieve the JsonElement fromJsonElement retrieved from the specified URL