mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Extract utils methods
This commit is contained in:
parent
35c72f692f
commit
184354ffb7
4 changed files with 272 additions and 224 deletions
|
@ -3,10 +3,6 @@ package org.asamk.signal.util;
|
|||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Util {
|
||||
|
||||
|
@ -23,28 +19,6 @@ public class Util {
|
|||
return f.toString();
|
||||
}
|
||||
|
||||
public static Map<String, String> getQueryMap(String query) {
|
||||
String[] params = query.split("&");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (String param : params) {
|
||||
String name = null;
|
||||
final String[] paramParts = param.split("=");
|
||||
try {
|
||||
name = URLDecoder.decode(paramParts[0], "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Impossible
|
||||
}
|
||||
String value = null;
|
||||
try {
|
||||
value = URLDecoder.decode(paramParts[1], "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Impossible
|
||||
}
|
||||
map.put(name, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static String join(CharSequence separator, Iterable<? extends CharSequence> list) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (CharSequence str : list) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue