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

12
LINES

< > BotCompany Repo | #1011460 // linesFromFile - returns CloseableItIt

JavaX fragment (include)

static CloseableItIt<S> linesFromFile(File f, IResourceHolder resourceHolder default null) ctex {
  if (!fileExists(f)) ret emptyCloseableIterableIterator();
  ifndef NoAutoGunzip
  if (ewic(f.getName(), ".gz"))
    ret linesFromReader(utf8bufferedReader(newGZIPInputStream(f)), resourceHolder);
  endifndef
  ret linesFromReader(utf8bufferedReader(f), resourceHolder);
}

static CloseableItIt<S> linesFromFile(S path, IResourceHolder resourceHolder default null) {
  ret linesFromFile(newFile(path), resourceHolder);
}

Author comment

Began life as a copy of #1008739

download  show line numbers  debug dex  old transpilations   

Travelled to 19 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv, yanjaxplzisb

No comments. add comment

Snippet ID: #1011460
Snippet name: linesFromFile - returns CloseableItIt
Eternal ID of this version: #1011460/15
Text MD5: 4d56ae82e3f9bff9f901207648d48ede
Author: stefan
Category: javax / i.o.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-01-15 16:44:46
Source code size: 530 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 616 / 829
Version history: 14 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1011774 - readerForFile - also handles .gz files
#1014124 - linesOfFile - synonym of linesFromFile
#1021217 - linesFromFile_bounded - end at certain byte index
#1025537 - linesFromFile_list