|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.umlv.tatoo.runtime.buffer.impl.UTF8Wrapper<T>
T - the type of the token view of the wrapperpublic class UTF8Wrapper<T>
The class provides a buffer for using with a lexer build with UTF-8 encoding
(UTF8Encoding).
It can wrap InputStream and ReadableByteChannel
| Method Summary | |
|---|---|
void |
discard()
Discards all characters already recognized by the lexer. |
LocationTracker |
getLocationProvider()
Returns a location provider. |
boolean |
hasRemaining()
Returns true if more characters are availables in the buffer. |
int |
lastChar()
Returns last read char or -1 if not available. |
int |
next()
Reads the next character from the buffer. |
boolean |
previousWasNewLine()
Determines if the last unwinded character was an end of line. |
boolean |
read()
Reads at some bytes from the stream. |
void |
reset()
Moves current position back to first non unwinded character. |
void |
restart()
Moves current position back to first non discarded character. |
void |
unwind(int count)
Unwinds count characters from the buffer. |
T |
view()
Return a view of the tokens recognized in the buffer. |
static UTF8Wrapper<ByteBuffer> |
wrap(boolean direct,
int capacity,
int increment,
int chunkSize,
ReadableByteChannel readable,
LocationTracker tracker)
Construct a UTF8Wrapper used by the lexer to process the ReadableByteChannel. |
static UTF8Wrapper<InputStream> |
wrap(InputStream inputStream,
LocationTracker tracker)
Constructs an UTF8Wrapper wrapper used by the lexer to process the InputStream. |
static UTF8Wrapper<InputStream> |
wrap(int capacity,
int increment,
int chunkSize,
InputStream inputStream,
LocationTracker tracker)
Construct a UTF8Wrapper used by the lexer to process the InputStream. |
static UTF8Wrapper<ByteBuffer> |
wrap(ReadableByteChannel readable,
LocationTracker tracker)
Constructs an UTF8Wrapper wrapper used by the lexer to process the ReadableByteChannel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static UTF8Wrapper<InputStream> wrap(int capacity,
int increment,
int chunkSize,
InputStream inputStream,
LocationTracker tracker)
UTF8Wrapper 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 tracker
public static UTF8Wrapper<InputStream> wrap(InputStream inputStream,
LocationTracker tracker)
UTF8Wrapper wrapper used by the lexer to process the InputStream.
inputStream - the InputStream to wraptracker - the location tracker
public static UTF8Wrapper<ByteBuffer> wrap(boolean direct,
int capacity,
int increment,
int chunkSize,
ReadableByteChannel readable,
LocationTracker tracker)
UTF8Wrapper used by the lexer to process the ReadableByteChannel.
The parameters specify how the underlying buffer which stores data in allocated and reallocated
when more space is needed.
direct - if the ByteBuffer must be directcapacity - 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 inputreadable - the inputtracker - the location tracker
public static UTF8Wrapper<ByteBuffer> wrap(ReadableByteChannel readable,
LocationTracker tracker)
UTF8Wrapper wrapper used by the lexer to process the ReadableByteChannel.
readable - the ReadableByteChannel to wraptracker - the location tracker
public int next()
LexerBuffer
next in interface LexerBufferpublic boolean hasRemaining()
LexerBuffer
hasRemaining in interface LexerBufferpublic void discard()
LexerBuffer
discard in interface LexerBufferdiscard in interface TokenBuffer<T>public void restart()
LexerBufferSimpleParser.push(Object)
for me details.
restart in interface LexerBufferpublic void unwind(int count)
LexerBuffercount characters from the buffer.
count must not be 0.
unwind in interface LexerBuffercount - the number of characters to unwindpublic void reset()
LexerBuffertokenizer.
reset in interface LexerBufferpublic boolean previousWasNewLine()
LexerBuffer
previousWasNewLine in interface LexerBuffertrue if the last unwinded character was an end of line;
false otherwise
public boolean read()
throws IOException
LexerBufferSimpleLexer.run().
read in interface LexerBufferfalse at end of stream
IOException - if an i/o operation failed.public T view()
view in interface TokenBuffer<T>ReadableByteChannelWrapper.view()public int lastChar()
LexerBuffer
lastChar in interface LexerBufferpublic LocationTracker getLocationProvider()
LexerBuffer
getLocationProvider in interface LexerBuffer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||