Convert to Maven Project

This commit is contained in:
Alexis Delhaie
2020-10-21 21:12:33 +02:00
parent 4a327bb683
commit 6293d4e52c
15 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package ovh.alexisdelhaie.endpoint.http.parsers;
import java.math.BigInteger;
import java.util.ArrayList;
public class Chunked {
public static ArrayList<String> parse(String body) {
ArrayList<String> result = new ArrayList<>();
try {
body = body.strip();
int length; int pos;
do {
pos = body.indexOf("\r\n");
length = Integer.parseInt(body.substring(0, pos), 16);
result.add(body.substring(pos + 2, length));
body = body.substring(pos + 2 + length);
} while (!body.isEmpty());
} catch (NumberFormatException e) {
result.add(body);
}
return result;
}
}