1 | sclass LinesBuffer {
|
2 | new L<S> completeLines; |
3 | S currentLine = ""; |
4 | |
5 | void append(S s) {
|
6 | currentLine += s; |
7 | int i; |
8 | while ((i = currentLine.indexOf('\n')) >= 0) {
|
9 | // inefficient |
10 | completeLines.add(dropTrailingBackslashR(substring(currentLine, 0, i))); |
11 | currentLine = substring(currentLine, i+1); |
12 | } |
13 | } |
14 | |
15 | L<S> getAndClearCompleteLines() { ret cloneAndClearList(completeLines); }
|
16 | } |
Began life as a copy of #1007086
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009574 |
| Snippet name: | LinesBuffer - text stream to lines |
| Eternal ID of this version: | #1009574/2 |
| Text MD5: | ae21c7de900bb98a96ac29f6d1c73ade |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-08-08 17:11:39 |
| Source code size: | 431 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 780 / 1395 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |