@Test public void uriInMiddleOfInput() throws Exception { String prefix = "prefix "; String uri = "ethereum:0xfdf1210fc262c73d0436236a0e07be419babbbc4?value=42"; String text = prefix + uri; parser.linkifyUri(text, prefix.length(), outputBuffer); assertLinkOnly(uri, outputBuffer); }
@Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = ETHEREUM_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String ethereumURI = matcher.group(); outputBuffer.append("<a href=\"") .append(ethereumURI) .append("\">") .append(ethereumURI) .append("</a>"); return matcher.end(); }
EthereumUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = ETHEREUM_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String ethereumURI = matcher.group(); outputBuffer.append("<a href=\"") .append(ethereumURI) .append("\">") .append(ethereumURI) .append("</a>"); return matcher.end(); } }
EthereumUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = ETHEREUM_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String ethereumURI = matcher.group(); outputBuffer.append("<a href=\"") .append(ethereumURI) .append("\">") .append(ethereumURI) .append("</a>"); return matcher.end(); }  }
EthereumUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = ETHEREUM_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String ethereumURI = matcher.group(); outputBuffer.append("<a href=\"") .append(ethereumURI) .append("\">") .append(ethereumURI) .append("</a>"); return matcher.end(); }  @Override int linkifyUri(String text, int startPos, StringBuffer outputBuffer); }
EthereumUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = ETHEREUM_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String ethereumURI = matcher.group(); outputBuffer.append("<a href=\"") .append(ethereumURI) .append("\">") .append(ethereumURI) .append("</a>"); return matcher.end(); }  @Override int linkifyUri(String text, int startPos, StringBuffer outputBuffer);  }