Jsoup parse from file to reduce memory usage

This commit is contained in:
M66B
2020-02-20 10:07:01 +01:00
parent 48a5278ba0
commit 873a696a52
6 changed files with 50 additions and 13 deletions

View File

@@ -23,6 +23,10 @@ import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
public class JsoupEx {
static Document parse(String html) {
@@ -47,4 +51,8 @@ org.jsoup.UncheckedIOException: java.io.IOException: Input is binary and unsuppo
return document;
}
}
static Document parse(File in) throws IOException {
return Jsoup.parse(in, StandardCharsets.UTF_8.name());
}
}