public class FNURLUtil
extends java.lang.Object
| Constructor and Description |
|---|
FNURLUtil() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull java.net.HttpURLConnection |
getConnection(@NotNull java.net.URL url)
接続を確立する
|
static @NotNull java.net.HttpURLConnection |
getConnection(@NotNull java.net.URL url,
@NotNull java.util.Map<java.lang.String,java.lang.String> headers)
接続を確立する
|
static @NotNull java.lang.String |
getResponse(@NotNull java.net.URL url)
文字列を取る
|
static java.util.concurrent.CompletableFuture<java.lang.Void> |
getResponseAsync(java.net.URL url,
java.util.function.Consumer<java.lang.String> stringConsumer)
非同期で文字列を取得
失敗時はnullを返す
|
static @NotNull PostResponse |
getResponseByPOST(@NotNull java.net.URL url,
byte[] body,
@NotNull java.util.Map<java.lang.String,java.lang.String> headers)
POSTでデータを送信
|
static @NotNull PostResponse |
getResponseByPOST(@NotNull java.net.URL url,
@NotNull PostRequest request)
POSTでデータを送信
|
static @NotNull PostResponse |
getResponseByPOST(@NotNull java.net.URL url,
@NotNull java.lang.String body,
@NotNull java.lang.String language,
@NotNull java.lang.String contentType)
POSTでテキストを送り返ってきた文字列とステータスコードを取得
|
static java.util.concurrent.CompletableFuture<java.lang.Void> |
getResponseByPOSTAsync(java.net.URL url,
java.lang.String body,
java.lang.String language,
java.lang.String contentType,
java.util.function.Consumer<PostResponse> responseConsumer)
POSTでテキストを送り返ってきた文字列とステータスコードを取得
|
static @NotNull java.io.InputStream |
getStream(@NotNull java.net.URL url)
ストリームを取る
|
static java.util.concurrent.CompletableFuture<java.lang.Void> |
getStreamAsync(java.net.URL url,
java.util.function.Consumer<java.io.InputStream> streamConsumer)
非同期でストリームを取得
失敗時はnullを返す
|
static @NotNull java.lang.String |
getUserAgent()
ユーザエージェント取得
|
static @Nullable java.net.URL |
newURL(@Nullable java.lang.String url)
例外なし new URL
|
@Nullable
public static @Nullable java.net.URL newURL(@Nullable
@Nullable java.lang.String url)
url - url@NotNull public static @NotNull java.lang.String getUserAgent()
@NotNull
public static @NotNull java.net.HttpURLConnection getConnection(@NotNull
@NotNull java.net.URL url,
@NotNull
@NotNull java.util.Map<java.lang.String,java.lang.String> headers)
throws java.io.IOException
url - URLheaders - ヘッダーjava.io.IOException - 接続失敗@NotNull
public static @NotNull java.net.HttpURLConnection getConnection(@NotNull
@NotNull java.net.URL url)
throws java.io.IOException
url - URLjava.io.IOException - 接続失敗@NotNull
public static @NotNull java.io.InputStream getStream(@NotNull
@NotNull java.net.URL url)
throws java.io.IOException
url - URLjava.io.IOException - 接続失敗@NotNull
public static @NotNull java.lang.String getResponse(@NotNull
@NotNull java.net.URL url)
throws java.io.IOException
url - URLjava.io.IOException - 接続失敗public static java.util.concurrent.CompletableFuture<java.lang.Void> getStreamAsync(java.net.URL url,
java.util.function.Consumer<java.io.InputStream> streamConsumer)
url - URLstreamConsumer - ストリームpublic static java.util.concurrent.CompletableFuture<java.lang.Void> getResponseAsync(java.net.URL url,
java.util.function.Consumer<java.lang.String> stringConsumer)
url - URLstringConsumer - 文字列public static java.util.concurrent.CompletableFuture<java.lang.Void> getResponseByPOSTAsync(java.net.URL url,
java.lang.String body,
java.lang.String language,
java.lang.String contentType,
java.util.function.Consumer<PostResponse> responseConsumer)
url - URLbody - テキストlanguage - 言語contentType - typeresponseConsumer - 返答とステータスコードのペア@NotNull public static @NotNull PostResponse getResponseByPOST(@NotNull @NotNull java.net.URL url, @NotNull @NotNull java.lang.String body, @NotNull @NotNull java.lang.String language, @NotNull @NotNull java.lang.String contentType) throws java.io.IOException
url - URLbody - テキストlanguage - 言語contentType - typejava.io.IOException - 例外@NotNull public static @NotNull PostResponse getResponseByPOST(@NotNull @NotNull java.net.URL url, byte[] body, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException
url - URLbody - 本体headers - ヘッダーjava.io.IOException - 例外@NotNull public static @NotNull PostResponse getResponseByPOST(@NotNull @NotNull java.net.URL url, @NotNull @NotNull PostRequest request) throws java.io.IOException
url - URLrequest - リクエストjava.io.IOException - 例外