Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
im-common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈永峰
im-common
Commits
348c411c
Unverified
Commit
348c411c
authored
Jul 31, 2021
by
yu
Committed by
GitHub
Jul 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add method docs and fix IDEA warnings (#9)
parent
f45ede40
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
HttpUtil.java
src/main/java/com/qcloud/im/util/HttpUtil.java
+19
-19
JsonUtil.java
src/main/java/com/qcloud/im/util/JsonUtil.java
+2
-2
SigUtil.java
src/main/java/com/qcloud/im/util/SigUtil.java
+1
-1
No files found.
src/main/java/com/qcloud/im/util/HttpUtil.java
View file @
348c411c
...
@@ -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
);
...
...
src/main/java/com/qcloud/im/util/JsonUtil.java
View file @
348c411c
...
@@ -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
{
p
ublic
static
final
ObjectMapper
OBJECT_MAPPER
=
new
ObjectMapper
();
p
rivate
static
final
ObjectMapper
OBJECT_MAPPER
=
new
ObjectMapper
();
p
ublic
static
final
ObjectMapper
INDENT_OUTPUT_OBJECT_MAPPER
=
new
ObjectMapper
();
p
rivate
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
);
...
...
src/main/java/com/qcloud/im/util/SigUtil.java
View file @
348c411c
...
@@ -143,7 +143,7 @@ public class SigUtil {
...
@@ -143,7 +143,7 @@ public class SigUtil {
0
,
compressedBytesLength
)))).
replaceAll
(
"\\s*"
,
""
);
0
,
compressedBytesLength
)))).
replaceAll
(
"\\s*"
,
""
);
}
}
p
ublic
static
byte
[]
genUserBuf
(
long
sdkAppId
,
String
account
,
long
dwAuthID
,
long
dwExpTime
,
p
rivate
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中
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment