| Constructor and Description |
|---|
SynchronizedSource(Snippet source) |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheIndex()
Backup the current index
|
int |
getAmountOfAvailableSource()
Get amount of source that is available to read
|
Snippet |
getAvailableSource()
Get available source to read as snippet
|
int |
getCachedIndex()
Get cached index
|
Optional<TokenInfo> |
getCurrent()
Get current token
|
int |
getIndex()
Get current index
|
Snippet |
getLastReadSource()
Get source that has been read since the last backup
|
TokenInfo |
getNext()
Get next token without updating index
|
@Nullable TokenInfo |
getPrevious()
Get previous token
|
@Nullable TokenInfo |
getPrevious(int previous)
Get previous token
|
Snippet |
getSource()
The original source used to create
SynchronizedSource |
boolean |
hasNext()
Check if source has available next token
|
Iterator<TokenInfo> |
iterator() |
TokenInfo |
next()
Read the next token and move index
|
void |
next(int amount)
Read the given amount of tokens
|
void |
setIndex(int index)
Set current index of source
|
SourceStream |
toStream()
Convert object to the source stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorforEachRemaining, removepublic SynchronizedSource(Snippet source)
public void cacheIndex()
public TokenInfo next()
public void next(int amount)
amount - the amount to readpublic boolean hasNext()
public void setIndex(int index)
index - the index to set@Nullable public @Nullable TokenInfo getPrevious()
getPrevious(int)@Nullable public @Nullable TokenInfo getPrevious(int previous)
previous - amount of previous tokens to skip (by default 0 - returns previous token)public TokenInfo getNext()
public Snippet getLastReadSource()
public Snippet getAvailableSource()
public int getAmountOfAvailableSource()
public int getCachedIndex()
public int getIndex()
public Snippet getSource()
SynchronizedSourcepublic SourceStream toStream()
StreamabletoStream in interface StreamableCopyright © 2020. All rights reserved.