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

22
LINES

< > BotCompany Repo | #1036186 // TailFileLinewise [dev.]

JavaX fragment (include)

sclass TailFileLinewise {
  settable File file;
  settable long startOffset;
  settable int interval = 1000;
  
  TailFile tf;
  LineBuffer lineBuffer = new(voidfunc(S s) { newLine(s) });
  
  event newLine(S line);
  
  void start {
    if (tf == null) ret;
    initialFileSize = l(file);
    tf = new TailFile(file, interval, s -> lineBuffer.append(s));
    tf.l = startOffset;
    tf.start();
  }
  
  bool readingHistory() {
    ret tf.currentFileSize() >= initialFileSize;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 1 computer(s): mqqgnosmbjvj

No comments. add comment

-
Snippet ID: #1036186
Snippet name: TailFileLinewise [dev.]
Eternal ID of this version: #1036186/2
Text MD5: 8f7fd7598f8fda9c7fa5c53d02269d0d
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-10 16:33:58
Source code size: 504 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 131 / 135
Version history: 1 change(s)
Referenced in: