Libraryless. Click here for Pure Java version (12843L/74K).
interface StringIO { replace SomethingHead with StringHead. void readWrite(SomethingHead head); default S saveToString(SomethingHead head default new) { var writer = stringWriter(); head.writer(writer); readWrite(head); head.finish(); ret str(writer); } default File saveToTextFile(File file) { temp Writer out = bufferedFileWriter(file); var head = new SomethingHead(out); readWrite(head); head.finish(); ret file; } default selfType load aka fromString(S data) { readWrite(new SomethingHead(stringReader(data))); this; } default selfType loadTextFile(File file) { temp var in = bufferedReader(file); readWrite(new SomethingHead(in)); this; } }
Began life as a copy of #1035635
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035760 |
Snippet name: | StringIO - read/writable using a StringHead |
Eternal ID of this version: | #1035760/6 |
Text MD5: | 095a29694301458fb80437df9af1cca7 |
Transpilation MD5: | 02ed52f23a50ec075834258262a33cd0 |
Author: | stefan |
Category: | javax / io |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-07-20 02:39:27 |
Source code size: | 767 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 138 / 227 |
Version history: | 5 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |