Repository navigation
Commit 75b2a18
authored
perf(file-system): single-pass Android readTextSync that keeps line breaks (#11653)
* perf(file-system): read the whole file in Android readTextSync
readTextSync made one JNI readLine() call per line and concatenated the lines in JS. It now reads the bytes in 64 KiB chunks and decodes them with a single ByteArrayOutputStream.toString(charset) call, and always closes the stream.
The line-by-line output is kept for now: CR and CRLF become LF, leading blank lines and the final line break are dropped.
* fix(file-system): return Android readTextSync content unchanged
readTextSync rebuilt the text from readLine() results, so CR and CRLF became LF, leading blank lines and the final line break were dropped. It now returns the decoded file content as is, like readText() on Android and readTextSync()/readText() on iOS. The UTF-8 BOM is still removed.1 parent 2f5441a commit 75b2a18
2 files changed
Lines changed: 35 additions & 25 deletions
File tree
- apps/automated/src/file-system
- packages/core/file-system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
785 | 785 | | |
786 | 786 | | |
787 | 787 | | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | 554 | | |
558 | 555 | | |
559 | 556 | | |
560 | 557 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | 558 | | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
| 559 | + | |
582 | 560 | | |
583 | 561 | | |
584 | 562 | | |
585 | 563 | | |
586 | 564 | | |
587 | 565 | | |
588 | | - | |
589 | | - | |
590 | 566 | | |
591 | 567 | | |
592 | 568 | | |
| |||
595 | 571 | | |
596 | 572 | | |
597 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
598 | 592 | | |
599 | 593 | | |
600 | 594 | | |
| |||
0 commit comments