|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.umlv.tatoo.runtime.buffer.impl.AbstractBufferWrapper fr.umlv.tatoo.runtime.buffer.impl.InputStreamWrapper
public class InputStreamWrapper
A ReadWrapper
wraps a Reader
in order to allow
a lexer to process it and a developper to extract tokens recognized.
Lexer
Constructor Summary | |
---|---|
InputStreamWrapper(InputStream inputStream,
LocationTracker tracker)
Constructs an InputStreamWrapper wrapper used by the lexer to process the InputStream . |
|
InputStreamWrapper(int capacity,
int increment,
int chunkSize,
InputStream inputStream,
LocationTracker tracker)
Construct a InputStreamWrapper used by the lexer to process the InputStream . |
Method Summary | |
---|---|
protected void |
discardImpl()
|
boolean |
hasRemaining()
Returns true if more characters are availables in the buffer. |
int |
lastChar()
Returns last read char or -1 if not available. |
protected int |
nextImpl()
Returns next character in buffer without taking care of locations |
boolean |
previousWasNewLine()
Determines if the last unwinded character was an end of line. |
boolean |
read()
Reads at some bytes from the stream. |
protected void |
resetImpl()
Moves current position back to first non unwinded character without taking care of locations |
protected void |
restartImpl()
|
String |
toString()
Returns a String representation of the current token using the platform default encoding. |
String |
toString(String encoding)
Returns a String representation of the current token using the specified encoding. |
protected void |
unwindImpl(int l)
Performs unwind operation on buffer without taking care of locations |
InputStream |
view()
Returns the token part of the buffer as a InputStream. |
Methods inherited from class fr.umlv.tatoo.runtime.buffer.impl.AbstractBufferWrapper |
---|
discard, getLocationProvider, locationClear, next, reset, restart, unwind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface fr.umlv.tatoo.runtime.buffer.TokenBuffer |
---|
discard |
Methods inherited from interface fr.umlv.tatoo.runtime.buffer.LexerBuffer |
---|
discard, getLocationProvider, next, reset, restart, unwind |
Constructor Detail |
---|
public InputStreamWrapper(InputStream inputStream, LocationTracker tracker)
InputStreamWrapper
wrapper used by the lexer to process the InputStream
.
inputStream
- the InputStream
to wraptracker
- the location trackerpublic InputStreamWrapper(int capacity, int increment, int chunkSize, InputStream inputStream, LocationTracker tracker)
InputStreamWrapper
used by the lexer to process the InputStream
.
The parameters specify how the underlying buffer which stores data in allocated and reallocated
when more space is needed.
capacity
- the initial capacityincrement
- how much to increment the size of the buffer when more space is requiredchunkSize
- how many bytes are read at once is the inputinputStream
- the inputtracker
- the location trackerMethod Detail |
---|
protected void unwindImpl(int l)
AbstractBufferWrapper
unwindImpl
in class AbstractBufferWrapper
l
- the number of characters to unwindLexerBuffer.unwind(int)
protected void resetImpl()
AbstractBufferWrapper
resetImpl
in class AbstractBufferWrapper
LexerBuffer.reset()
public boolean previousWasNewLine()
LexerBuffer
previousWasNewLine
in interface LexerBuffer
true
if the last unwinded character was an end of line;
false
otherwisepublic boolean hasRemaining()
LexerBuffer
hasRemaining
in interface LexerBuffer
public boolean read() throws IOException
LexerBuffer
SimpleLexer.run()
.
read
in interface LexerBuffer
false
at end of stream
IOException
- if an i/o operation failed.protected int nextImpl()
AbstractBufferWrapper
nextImpl
in class AbstractBufferWrapper
LexerBuffer.next()
protected void discardImpl()
discardImpl
in class AbstractBufferWrapper
public String toString()
CharsetDecoder
at each call.
toString
in class Object
Charset.defaultCharset()
public String toString(String encoding)
CharsetDecoder
at each call.
encoding
- the character encoding
IllegalCharsetNameException
- if the encoding is not supportedCharset
protected void restartImpl()
restartImpl
in class AbstractBufferWrapper
public InputStream view()
view
in interface TokenBuffer<InputStream>
public int lastChar()
LexerBuffer
lastChar
in interface LexerBuffer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |