Libraryless. Click here for Pure Java version (2947L/19K).
static CloseableCharSequence iso8859_readOnlyFileAsCharSequence(File f, O... _) { optPar bool noToString; // if set, only subsequences can be converted to a string optPar long start = 0; int l = toInt_safe(l(f)-start); RandomAccessFile raf = randomAccessFileForReading(f); ret new CloseableCharSequence { public int length() { ret l; } public char charAt(int i) ctex { raf.seek(start+i); ret (char) raf.readByte(); } public CharSequence subSequence(int from, int to) { ret substringObject(this, from, to); } toString { if (noToString) fail("Too big for converting to string"); ret charSequenceToStringByChar(this); } public void close { _close(raf); } }; }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029255 |
Snippet name: | iso8859_readOnlyFileAsCharSequence |
Eternal ID of this version: | #1029255/11 |
Text MD5: | f90a5d0b57149c25687d0c89071e461c |
Transpilation MD5: | 2f4c09ab62f4ad7053dff115a39132c8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-29 21:46:03 |
Source code size: | 723 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 240 / 365 |
Version history: | 10 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |