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

12
LINES

< > BotCompany Repo | #1028344 // raf_findEndOfLine - returns index of \n + 1

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2496L/16K).

static long raf_findEndOfLine(RandomAccessFile raf, long pos, int bufSize) ctex {
  byte[] buf = new byte[bufSize];
  long length = raf.length();
  while (pos < length) {
    raf.seek(pos);
    raf.readFully(buf, 0, (int) Math.min(length-pos, bufSize));
    int idx = indexOf_byteArray(buf, (byte) '\n');
    if (idx >= 0) ret pos+idx+1;
    pos += bufSize;
  }
  ret length;
}

Author comment

Began life as a copy of #1028342

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: #1028344
Snippet name: raf_findEndOfLine - returns index of \n + 1
Eternal ID of this version: #1028344/3
Text MD5: 26cb3b6aa1a00cd4708f30be5868a9c5
Transpilation MD5: e54e1954d36fcc541b69a8062eca4d7d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-13 11:36:46
Source code size: 388 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 223 / 299
Version history: 2 change(s)
Referenced in: [show references]