Clean up code

This commit is contained in:
gdlbo
2022-04-28 21:11:04 +03:00
parent cdcf218160
commit c711c3126e
53 changed files with 756 additions and 722 deletions
+12 -12
View File
@@ -16,14 +16,24 @@ import java.util.Map;
import java.util.TreeMap;
public final class NetCall {
private NetRequest req;
private NetClient cl;
private final NetRequest req;
private final NetClient cl;
protected NetCall(NetClient cl, NetRequest req) {
this.req = req;
this.cl = cl;
}
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
args = new TreeMap<>(args);
String str = "";
for (Map.Entry<String, String> en : args.entrySet()) {
if (!str.isEmpty()) str += "&";
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
}
return str;
}
public NetRequest request() {
return req;
}
@@ -65,16 +75,6 @@ public final class NetCall {
return r;
}
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
args = new TreeMap<>(args);
String str = "";
for (Map.Entry<String, String> en : args.entrySet()) {
if (!str.isEmpty()) str += "&";
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
}
return str;
}
public void enqueue(NetCallback cb) {
new Thread() {
@Override