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).

1  
static long raf_findEndOfLine(RandomAccessFile raf, long pos, int bufSize) ctex {
2  
  byte[] buf = new byte[bufSize];
3  
  long length = raf.length();
4  
  while (pos < length) {
5  
    raf.seek(pos);
6  
    raf.readFully(buf, 0, (int) Math.min(length-pos, bufSize));
7  
    int idx = indexOf_byteArray(buf, (byte) '\n');
8  
    if (idx >= 0) ret pos+idx+1;
9  
    pos += bufSize;
10  
  }
11  
  ret length;
12  
}

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: 126 / 199
Version history: 2 change(s)
Referenced in: [show references]