/** * Tokenizes a specified region by an occurrences of the pattern. * Note that a series of adjacent matches are regarded as a single separator. * The same as new RETokenizer(Pattern,Reader,int); * * @see RETokenizer * @see RETokenizer#RETokenizer(regexodus.Pattern, java.io.Reader, int) */ @GwtIncompatible public RETokenizer tokenizer(Reader in, int length) throws IOException { return new RETokenizer(this, in, length); }
/** * Tokenizes a specified region by an occurrences of the pattern. * Note that a series of adjacent matches are regarded as a single separator. * The same as new RETokenizer(Pattern,Reader,int); * * @see RETokenizer * @see RETokenizer#RETokenizer(regexodus.Pattern, java.io.Reader, int) */ @GwtIncompatible public RETokenizer tokenizer(Reader in, int length) throws IOException { return new RETokenizer(this, in, length); }
@GwtIncompatible public RETokenizer(Pattern pattern, Reader r, int len) throws IOException { this(pattern.matcher(r, len), false); }
@GwtIncompatible public RETokenizer(Pattern pattern, Reader r, int len) throws IOException { this(pattern.matcher(r, len), false); }
@GwtIncompatible public String replace(Reader text, int length) throws IOException { TextBuffer tb = wrap(new StringBuilder(length >= 0 ? length : 0)); replace(pattern.matcher(text, length), substitution, tb); return tb.toString(); }
@GwtIncompatible private static int replace(Matcher m, Substitution substitution, Writer out) throws IOException { try { return replace(m, substitution, wrap(out)); } catch (WriteException e) { throw e.reason; } }
@GwtIncompatible public String replace(Reader text, int length) throws IOException { TextBuffer tb = wrap(new StringBuilder(length >= 0 ? length : 0)); replace(pattern.matcher(text, length), substitution, tb); return tb.toString(); }
@GwtIncompatible private static int replace(Matcher m, Substitution substitution, Writer out) throws IOException { try { return replace(m, substitution, wrap(out)); } catch (WriteException e) { throw e.reason; } }
@GwtIncompatible public int replace(Reader text, int length, StringBuilder sb) throws IOException { return replace(text, length, wrap(sb)); }
@GwtIncompatible public void replace(MatchResult res, String groupName, Writer out) throws IOException { replace(pattern.matcher(res, groupName), substitution, out); }
@GwtIncompatible private int replace(Reader text, int length, TextBuffer dest) throws IOException { return replace(pattern.matcher(text, length), substitution, dest); }
@GwtIncompatible public void replace(MatchResult res, int group, Writer out) throws IOException { replace(pattern.matcher(res, group), substitution, out); }
@GwtIncompatible public void replace(MatchResult res, String groupName, Writer out) throws IOException { replace(pattern.matcher(res, groupName), substitution, out); }
@GwtIncompatible public void replace(CharSequence text, Writer out) throws IOException { replace(pattern.matcher(text), substitution, out); }
@GwtIncompatible public void replace(Reader in, int length, Writer out) throws IOException { replace(pattern.matcher(in, length), substitution, out); }
@GwtIncompatible public int replace(Reader text, int length, StringBuilder sb) throws IOException { return replace(text, length, wrap(sb)); }
@GwtIncompatible private int replace(Reader text, int length, TextBuffer dest) throws IOException { return replace(pattern.matcher(text, length), substitution, dest); }
@GwtIncompatible public void replace(MatchResult res, int group, Writer out) throws IOException { replace(pattern.matcher(res, group), substitution, out); }
/** * Returns a matcher taking a text stream as target. * <b>Note that this is not a true POSIX-style stream matching</b>, i.e. the whole length of the text is preliminary read and stored in a char array. * * @param text a text stream * @param length the length to read from a stream; if <code>len</code> is <code>-1</code>, the whole stream is read in. * @throws IOException indicates an IO problem */ @GwtIncompatible public Matcher matcher(Reader text, int length) throws IOException { Matcher m = new Matcher(this); m.setTarget(text, length); return m; }
@GwtIncompatible public void replace(Reader in, int length, Writer out) throws IOException { replace(pattern.matcher(in, length), substitution, out); }