Package com.luna.common.net.base
Class HttpBaseUtils
java.lang.Object
com.luna.common.net.base.HttpBaseUtils
- Author:
- luna@mac 2021年05月12日 09:42
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
doURL
(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, byte[] file) doURLstatic InputStream
doURL
(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, String body) doURLstatic byte[]
doURLWithByte
(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, File file) static byte[]
doURLWithByte
(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, String body) static String
doURLWithString
(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, File file) static String
doURLWithString
(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, String body) static void
流转文件static HttpURLConnection
static void
printCookie
(CookieStore cookieStore) static byte[]
readWithByte
(InputStream inputStream) 读取字节static byte[]
readWithByte
(InputStream inputStream, int bufferSize) 流读取字节static String
readWithReader
(Reader rd) 读取static String
readWithString
(InputStream inputStream) 读取字符static String
readWithString
(InputStream inputStream, int bufferSize) 读取字符static String
readWithString
(InputStream inputStream, String charsetName) 字符编码指定格式读取static CookieStore
-
Constructor Details
-
HttpBaseUtils
public HttpBaseUtils()
-
-
Method Details
-
getConn
-
doURL
public static InputStream doURL(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, String body) doURL- Parameters:
host
- 主机地址path
- 路径headers
- 请求头queries
- 请求参数body
- 请求体- Returns:
- 输入流
-
doURL
public static InputStream doURL(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, byte[] file) doURL- Parameters:
host
- 主机地址path
- 路径headers
- 请求头queries
- 请求参数file
- 请求体- Returns:
- InputStream
-
doURLWithByte
-
doURLWithString
-
doURLWithByte
-
doURLWithString
-
download
流转文件- Parameters:
url
- 请求地址path
- 文件路径
-
readWithByte
流读取字节- Parameters:
inputStream
- 输入流bufferSize
- 缓冲区大小
-
readWithString
读取字符- Parameters:
inputStream
- 输入流- Returns:
- String
-
readWithReader
读取- Parameters:
rd
- 输入字符流- Returns:
- String
-
readWithString
字符编码指定格式读取- Parameters:
inputStream
- 输入流charsetName
- 编码格式- Returns:
- String
-
readWithString
读取字符- Parameters:
inputStream
- 输入流- Returns:
- String
-
readWithByte
读取字节- Parameters:
inputStream
- 输入流- Returns:
- String
-
setCookieManager
-
printCookie
-