}
lineComplete = false;
- Matcher matcher = whitespacePattern.matcher(line);
- int nextSpace = matcher.find(0) ? matcher.start() : line.length();
+ int nextSpace = findNextWhitespace(line);
String link = line.substring(0, nextSpace);
String name = link;
logger.log(Level.FINER, String.format("Found link: %s", link));
return parts;
}
+ private int findNextWhitespace(String line) {
+ Matcher matcher = whitespacePattern.matcher(line);
+ return matcher.find(0) ? matcher.start() : line.length();
+ }
+
private Optional<NextLink> findNextLink(String line) {
EnumMap<LinkType, Integer> linkTypeIndexes = new EnumMap<LinkType, Integer>(LinkType.class);
for (LinkType linkType : LinkType.values()) {