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:
@@ -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
|
||||
Reference in New Issue
Block a user