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

12
LINES

< > BotCompany Repo | #1028342 // raf_findBeginningOfLine [dev.]

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

Transpiled version (2495L) is out of date.

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

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: #1028342
Snippet name: raf_findBeginningOfLine [dev.]
Eternal ID of this version: #1028342/12
Text MD5: b2a33fbe882674f0f75878cdca5c40b7
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:37:26
Source code size: 401 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 227 / 348
Version history: 11 change(s)
Referenced in: [show references]