@Test public void testPeekTo() { CodeReader reader = new CodeReader(new StringReader("package org.sonar;")); StringBuilder result = new StringBuilder(); reader.peekTo(new EndMatcher() { @Override public boolean match(int endFlag) { return 'r' == (char) endFlag; } }, result); assertEquals("package o", result.toString()); assertThat(reader.peek(), is((int) 'p')); }
public final void peekTo(EndMatcher matcher, Appendable appendable) { int index = 0; int nextChar = intAt(index); try { while (!matcher.match(nextChar) && nextChar != -1) { appendable.append((char) nextChar); ++index; nextChar = intAt(index); } } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } }
CodeReader extends CodeBuffer { public final void peekTo(EndMatcher matcher, Appendable appendable) { int index = 0; int nextChar = intAt(index); try { while (!matcher.match(nextChar) && nextChar != -1) { appendable.append((char) nextChar); ++index; nextChar = intAt(index); } } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } } }
CodeReader extends CodeBuffer { public final void peekTo(EndMatcher matcher, Appendable appendable) { int index = 0; int nextChar = intAt(index); try { while (!matcher.match(nextChar) && nextChar != -1) { appendable.append((char) nextChar); ++index; nextChar = intAt(index); } } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } } CodeReader(Reader code);  CodeReader(String code);  CodeReader(Reader code, CodeReaderConfiguration configuration);  CodeReader(String code, CodeReaderConfiguration configuration); }
CodeReader extends CodeBuffer { public final void peekTo(EndMatcher matcher, Appendable appendable) { int index = 0; int nextChar = intAt(index); try { while (!matcher.match(nextChar) && nextChar != -1) { appendable.append((char) nextChar); ++index; nextChar = intAt(index); } } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } } CodeReader(Reader code);  CodeReader(String code);  CodeReader(Reader code, CodeReaderConfiguration configuration);  CodeReader(String code, CodeReaderConfiguration configuration); final void pop(Appendable appendable); final char[] peek(int length); final void peekTo(EndMatcher matcher, Appendable appendable); final int popTo(Matcher matcher, Appendable appendable); final int popTo(Matcher matcher, Matcher afterMatcher, Appendable appendable); final Cursor getPreviousCursor(); }
CodeReader extends CodeBuffer { public final void peekTo(EndMatcher matcher, Appendable appendable) { int index = 0; int nextChar = intAt(index); try { while (!matcher.match(nextChar) && nextChar != -1) { appendable.append((char) nextChar); ++index; nextChar = intAt(index); } } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } } CodeReader(Reader code);  CodeReader(String code);  CodeReader(Reader code, CodeReaderConfiguration configuration);  CodeReader(String code, CodeReaderConfiguration configuration); final void pop(Appendable appendable); final char[] peek(int length); final void peekTo(EndMatcher matcher, Appendable appendable); final int popTo(Matcher matcher, Appendable appendable); final int popTo(Matcher matcher, Matcher afterMatcher, Appendable appendable); final Cursor getPreviousCursor();  }