bufferedreader: read a file line by line module (BufferedReader vs Scanner vs Files.lines vs readAllLines on a 1 GB file; heap at -Xmx64m, timings, read-call counts, one-huge-line OOM, charset/BOM/line-terminator pitfalls, Scanner swallowing IOException), 10 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3pDoGLiWk6LLBeHjW
This commit is contained in:
Claude
2026-11-15 01:20:37 +05:30
parent 5faa57bb2d
commit f8c9e244a3
25 changed files with 809 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
input | BufferedReader.readLine() | Scanner.nextLine() | split("\n").length
--------------------------------------------------------------------------------------------------------
"a\nb" | ["a", "b"] | ["a", "b"] | 2
"a\nb\n" | ["a", "b"] | ["a", "b"] | 2
"a\nb\n\n" | ["a", "b", ""] | ["a", "b", ""] | 2
"a\r\nb" | ["a", "b"] | ["a", "b"] | 2
"a\rb" | ["a", "b"] | ["a", "b"] | 1
"" | [] | [] | 1
"\n" | [""] | [""] | 0
"a\n\rb" | ["a", "", "b"] | ["a", "", "b"] | 2