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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamdoURL(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, byte[] file) doURLstatic InputStreamdoURL(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 StringdoURLWithString(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, File file) static StringdoURLWithString(String host, String path, String method, Map<String, String> headers, Map<String, String> queries, String body) static void流转文件static HttpURLConnectionstatic voidprintCookie(CookieStore cookieStore) static byte[]readWithByte(InputStream inputStream) 读取字节static byte[]readWithByte(InputStream inputStream, int bufferSize) 流读取字节static StringreadWithReader(Reader rd) 读取static StringreadWithString(InputStream inputStream) 读取字符static StringreadWithString(InputStream inputStream, int bufferSize) 读取字符static StringreadWithString(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
-