Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1008169 - readerToString - fully read from Reader into string and close it

JavaX fragment (include)

static S readerToString(Reader r) ctex {
  try {
    new StringBuilder buf;
    int n = 0;
    while (true) {
      int ch = r.read();
      if (ch < 0)
        break;
      buf.append((char) ch);
      ++n;
      //if ((n % loadPage_verboseness) == 0) print("  " + n + " chars read");
    }
    ret buf.toString();
  } finally {
    r.close();
  }  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, ofpaelxlmzfo, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, qsqiayxyrbia, tslmcundralx, tvejysmllsmz, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1008169
Snippet name: readerToString - fully read from Reader into string and close it
Eternal ID of this version: #1008169/2
Text MD5: 45b6e4a238f57d8c6793119c5bec562f
Author: stefan
Category: javax / i.o.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-29 16:51:03
Source code size: 368 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 310 / 1557
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1008169 & http://1008169.tinybrain.de