Read text input streams as UTF-8 in Java (#6999)

Fixes https://errorprone.info/bugpattern/DefaultCharset for InputStreamReader instances.
This commit is contained in:
David Vo
2024-08-25 02:05:00 +10:00
committed by GitHub
parent 1fd1dc31b7
commit dbeab8bdd7
3 changed files with 5 additions and 3 deletions

View File

@@ -95,7 +95,7 @@ public final class ClassPreloader {
* @return Number of classes loaded.
*/
public static int preload(InputStream stream) {
return preload(new BufferedReader(new InputStreamReader(stream)));
return preload(new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)));
}
/**