Unverified Commit 348c411c authored by yu's avatar yu Committed by GitHub

docs: add method docs and fix IDEA warnings (#9)

parent f45ede40
...@@ -19,9 +19,9 @@ public class HttpUtil { ...@@ -19,9 +19,9 @@ public class HttpUtil {
/** /**
* Send a get request * Send a get request
* *
* @param url * @param url Url as string
* @return response * @return response
* @throws IOException * @throws IOException IOException
*/ */
public static String get(String url) throws IOException { public static String get(String url) throws IOException {
return get(url, null); return get(url, null);
...@@ -33,7 +33,7 @@ public class HttpUtil { ...@@ -33,7 +33,7 @@ public class HttpUtil {
* @param url Url as string * @param url Url as string
* @param headers Optional map with headers * @param headers Optional map with headers
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String get(String url, public static String get(String url,
Map<String, String> headers) throws IOException { Map<String, String> headers) throws IOException {
...@@ -47,7 +47,7 @@ public class HttpUtil { ...@@ -47,7 +47,7 @@ public class HttpUtil {
* @param body Request body as string * @param body Request body as string
* @param headers Optional map with headers * @param headers Optional map with headers
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String post(String url, String body, public static String post(String url, String body,
Map<String, String> headers) throws IOException { Map<String, String> headers) throws IOException {
...@@ -60,7 +60,7 @@ public class HttpUtil { ...@@ -60,7 +60,7 @@ public class HttpUtil {
* @param url Url as string * @param url Url as string
* @param body Request body as string * @param body Request body as string
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String post(String url, String body) throws IOException { public static String post(String url, String body) throws IOException {
return post(url, body, null); return post(url, body, null);
...@@ -72,7 +72,7 @@ public class HttpUtil { ...@@ -72,7 +72,7 @@ public class HttpUtil {
* @param url Url as string * @param url Url as string
* @param jsonStr a json string * @param jsonStr a json string
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String postJson(String url, String jsonStr) throws IOException { public static String postJson(String url, String jsonStr) throws IOException {
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
...@@ -86,7 +86,7 @@ public class HttpUtil { ...@@ -86,7 +86,7 @@ public class HttpUtil {
* @param url Url as string * @param url Url as string
* @param params map with parameters/values * @param params map with parameters/values
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String postForm(String url, Map<String, String> params) public static String postForm(String url, Map<String, String> params)
throws IOException { throws IOException {
...@@ -100,7 +100,7 @@ public class HttpUtil { ...@@ -100,7 +100,7 @@ public class HttpUtil {
* @param params Map with parameters/values * @param params Map with parameters/values
* @param headers Optional map with headers * @param headers Optional map with headers
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String postForm(String url, Map<String, String> params, public static String postForm(String url, Map<String, String> params,
Map<String, String> headers) throws IOException { Map<String, String> headers) throws IOException {
...@@ -136,7 +136,7 @@ public class HttpUtil { ...@@ -136,7 +136,7 @@ public class HttpUtil {
* @param body Request body as string * @param body Request body as string
* @param headers Optional map with headers * @param headers Optional map with headers
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String put(String url, String body, public static String put(String url, String body,
Map<String, String> headers) throws IOException { Map<String, String> headers) throws IOException {
...@@ -148,7 +148,7 @@ public class HttpUtil { ...@@ -148,7 +148,7 @@ public class HttpUtil {
* *
* @param url Url as string * @param url Url as string
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String put(String url, String body) throws IOException { public static String put(String url, String body) throws IOException {
return put(url, body, null); return put(url, body, null);
...@@ -160,7 +160,7 @@ public class HttpUtil { ...@@ -160,7 +160,7 @@ public class HttpUtil {
* @param url Url as string * @param url Url as string
* @param headers Optional map with headers * @param headers Optional map with headers
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String delete(String url, public static String delete(String url,
Map<String, String> headers) throws IOException { Map<String, String> headers) throws IOException {
...@@ -172,7 +172,7 @@ public class HttpUtil { ...@@ -172,7 +172,7 @@ public class HttpUtil {
* *
* @param url Url as string * @param url Url as string
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String delete(String url) throws IOException { public static String delete(String url) throws IOException {
return delete(url, null); return delete(url, null);
...@@ -184,7 +184,7 @@ public class HttpUtil { ...@@ -184,7 +184,7 @@ public class HttpUtil {
* @param url Url as string * @param url Url as string
* @param params Map with query parameters * @param params Map with query parameters
* @return url Url with query parameters appended * @return url Url with query parameters appended
* @throws IOException * @throws IOException IOException
*/ */
public static String appendQueryParams(String url, public static String appendQueryParams(String url,
Map<String, String> params) throws IOException { Map<String, String> params) throws IOException {
...@@ -212,7 +212,7 @@ public class HttpUtil { ...@@ -212,7 +212,7 @@ public class HttpUtil {
* *
* @param url Url containing query parameters * @param url Url containing query parameters
* @return params Map with query parameters * @return params Map with query parameters
* @throws IOException * @throws IOException IOException
*/ */
public static Map<String, String> getQueryParams(String url) public static Map<String, String> getQueryParams(String url)
throws IOException { throws IOException {
...@@ -252,7 +252,7 @@ public class HttpUtil { ...@@ -252,7 +252,7 @@ public class HttpUtil {
* *
* @param url Url containing query parameters * @param url Url containing query parameters
* @return url Url without query parameters * @return url Url without query parameters
* @throws IOException * @throws IOException IOException
*/ */
public static String removeQueryParams(String url) public static String removeQueryParams(String url)
throws IOException { throws IOException {
...@@ -272,7 +272,7 @@ public class HttpUtil { ...@@ -272,7 +272,7 @@ public class HttpUtil {
* @param body Request body as string * @param body Request body as string
* @param headers Optional map with headers * @param headers Optional map with headers
* @return response Response as string * @return response Response as string
* @throws IOException * @throws IOException IOException
*/ */
public static String fetch(String method, String url, String body, public static String fetch(String method, String url, String body,
Map<String, String> headers) throws IOException { Map<String, String> headers) throws IOException {
...@@ -319,9 +319,9 @@ public class HttpUtil { ...@@ -319,9 +319,9 @@ public class HttpUtil {
/** /**
* Read an input stream from conn into a string * Read an input stream from conn into a string
* *
* @param in * @param in InputStream
* @return * @return InputStream as string
* @throws IOException * @throws IOException IOException
*/ */
public static String streamToString(InputStream in) throws IOException { public static String streamToString(InputStream in) throws IOException {
InputStreamReader isr = new InputStreamReader(in, StandardCharsets.UTF_8); InputStreamReader isr = new InputStreamReader(in, StandardCharsets.UTF_8);
......
...@@ -17,8 +17,8 @@ import java.io.IOException; ...@@ -17,8 +17,8 @@ import java.io.IOException;
* @since 2021/7/27 17:41 * @since 2021/7/27 17:41
*/ */
public class JsonUtil { public class JsonUtil {
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
public static final ObjectMapper INDENT_OUTPUT_OBJECT_MAPPER = new ObjectMapper(); private static final ObjectMapper INDENT_OUTPUT_OBJECT_MAPPER = new ObjectMapper();
static { static {
OBJECT_MAPPER.enable(MapperFeature.USE_GETTERS_AS_SETTERS); OBJECT_MAPPER.enable(MapperFeature.USE_GETTERS_AS_SETTERS);
......
...@@ -143,8 +143,8 @@ public class SigUtil { ...@@ -143,8 +143,8 @@ public class SigUtil {
0, compressedBytesLength)))).replaceAll("\\s*", ""); 0, compressedBytesLength)))).replaceAll("\\s*", "");
} }
public static byte[] genUserBuf(long sdkAppId, String account, long dwAuthID, long dwExpTime, private static byte[] genUserBuf(long sdkAppId, String account, long dwAuthID, long dwExpTime,
long dwPrivilegeMap, long dwAccountType, String roomStr) { long dwPrivilegeMap, long dwAccountType, String roomStr) {
//视频校验位需要用到的字段,按照网络字节序放入buf中 //视频校验位需要用到的字段,按照网络字节序放入buf中
/* /*
cVer unsigned char/1 版本号,填0 cVer unsigned char/1 版本号,填0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment