|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sonar.channel.CodeBuffer org.sonar.channel.CodeReader
public class CodeReader
The CodeReader class provides some advanced features to read a source code. The most important one is the ability to try consuming the next characters in the stream according to a regular expression.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.sonar.channel.CodeBuffer |
---|
CodeBuffer.Cursor |
Constructor Summary | |
---|---|
CodeReader(Reader code)
|
|
CodeReader(Reader code,
CodeReaderConfiguration configuration)
Creates a code reader with specific configuration parameters. |
|
CodeReader(String code)
|
|
CodeReader(String code,
CodeReaderConfiguration configuration)
Creates a code reader with specific configuration parameters. |
Method Summary | |
---|---|
CodeBuffer.Cursor |
getPreviousCursor()
|
char[] |
peek(int length)
Read without consuming the next characters |
String |
peekTo(EndMatcher matcher)
Deprecated. in 2.2, use peekTo(EndMatcher matcher, Appendable appendable) instead |
void |
peekTo(EndMatcher matcher,
Appendable appendable)
Read without consuming the next characters until a condition is reached (EndMatcher) |
void |
pop(Appendable appendable)
Read and consume the next character |
void |
popTo(EndMatcher matcher,
Appendable appendable)
Deprecated. in 2.2, use popTo(Matcher matcher, Appendable appendable) instead |
int |
popTo(Matcher matcher,
Appendable appendable)
Read and consume the next characters according to a given regular expression |
int |
popTo(Matcher matcher,
Matcher afterMatcher,
Appendable appendable)
Read and consume the next characters according to a given regular expression. |
Methods inherited from class org.sonar.channel.CodeBuffer |
---|
charAt, close, getColumnPosition, getCursor, getLinePosition, intAt, lastChar, length, peek, pop, setColumnPosition, setLinePosition, startRecording, stopRecording, subSequence, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CodeReader(Reader code)
public CodeReader(String code)
public CodeReader(Reader code, CodeReaderConfiguration configuration)
code
- the Reader to read code fromconfiguration
- the configuration parameterspublic CodeReader(String code, CodeReaderConfiguration configuration)
code
- the code itselfconfiguration
- the configuration parametersMethod Detail |
---|
public final void pop(Appendable appendable)
appendable
- the read character is appended to appendablepublic final char[] peek(int length)
length
- number of character to read
public final void peekTo(EndMatcher matcher, Appendable appendable)
matcher
- the EndMatcher used to stop the readingappendable
- the read characters is appended to appendable@Deprecated public final String peekTo(EndMatcher matcher)
peekTo(EndMatcher matcher, Appendable appendable)
instead
@Deprecated public final void popTo(EndMatcher matcher, Appendable appendable)
popTo(Matcher matcher, Appendable appendable)
instead
public final int popTo(Matcher matcher, Appendable appendable)
matcher
- the regular expression matcherappendable
- the consumed characters are appended to this appendable
public final int popTo(Matcher matcher, Matcher afterMatcher, Appendable appendable)
matcher
- the Matcher used to try consuming next charactersafterMatcher
- the Matcher used to check character sequence immediately following the consumed charactersappendable
- the consumed characters are appended to this appendable
public final CodeBuffer.Cursor getPreviousCursor()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |