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

17
LINES

< > BotCompany Repo | #1020431 // aggressivelyCollectLatinCharacterSequencesOfMaxLength_intersperseNulls - return some nulls when scanning for too long

JavaX fragment (include)

static ItIt<S> aggressivelyCollectLatinCharacterSequencesOfMaxLength_intersperseNulls(final int maxLength, final InputStream in) {
  if (in == null) ret emptyItIt();
  ret iteratorFromFunction_withEndMarker(func -> S {
    int c, countdown = 65536;
    while (licensed() && (c = in.read()) >= 0)
      if (isLatinChar((char) c)) {
        new StringBuilder buf;
        buf.append((char) c);
        while (licensed() && l(buf) < maxLength && (c = in.read()) >= 0
          && isLatinChar((char) c))
          buf.append((char) c);
        ret str(buf);
      } else
        if (--countdown < 0) null;
    ret endMarker();
  });
}

Author comment

Began life as a copy of #1020426

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020431
Snippet name: aggressivelyCollectLatinCharacterSequencesOfMaxLength_intersperseNulls - return some nulls when scanning for too long
Eternal ID of this version: #1020431/4
Text MD5: deaecbbf8f511a079b2d53879ecc9779
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-21 16:54:40
Source code size: 646 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 318 / 346
Version history: 3 change(s)
Referenced in: [show references]