Package org.eclipse.jface.text.rules
Class BufferedRuleBasedScanner
- java.lang.Object
-
- org.eclipse.jface.text.rules.RuleBasedScanner
-
- org.eclipse.jface.text.rules.BufferedRuleBasedScanner
-
- All Implemented Interfaces:
ICharacterScanner,ITokenScanner
- Direct Known Subclasses:
RuleBasedPartitionScanner
public class BufferedRuleBasedScanner extends RuleBasedScanner
A buffered rule based scanner. The buffer always contains a section of a fixed size of the document to be scanned. Completely adheres to the contract ofRuleBasedScanner.
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
fColumn, fDefaultReturnToken, fDelimiters, fDocument, fOffset, fRangeEnd, fRules, fTokenOffset, UNDEFINED
-
Fields inherited from interface org.eclipse.jface.text.rules.ICharacterScanner
EOF
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBufferedRuleBasedScanner()Creates a new buffered rule based scanner which does not have any rule and a default buffer size of 500 characters.BufferedRuleBasedScanner(int size)Creates a new buffered rule based scanner which does not have any rule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intread()Returns the next character or EOF if end of file has been reachedprotected voidsetBufferSize(int size)Sets the buffer to the given number of characters.voidsetRange(IDocument document, int offset, int length)Configures the scanner by providing access to the document range that should be scanned.voidunread()Rewinds the scanner before the last read character.-
Methods inherited from class org.eclipse.jface.text.rules.RuleBasedScanner
getColumn, getLegalLineDelimiters, getTokenLength, getTokenOffset, nextToken, setDefaultReturnToken, setRules
-
-
-
-
Constructor Detail
-
BufferedRuleBasedScanner
protected BufferedRuleBasedScanner()
Creates a new buffered rule based scanner which does not have any rule and a default buffer size of 500 characters.
-
BufferedRuleBasedScanner
public BufferedRuleBasedScanner(int size)
Creates a new buffered rule based scanner which does not have any rule. The buffer size is set to the given number of characters.- Parameters:
size- the buffer size
-
-
Method Detail
-
setBufferSize
protected void setBufferSize(int size)
Sets the buffer to the given number of characters.- Parameters:
size- the buffer size
-
setRange
public void setRange(IDocument document, int offset, int length)
Description copied from interface:ITokenScannerConfigures the scanner by providing access to the document range that should be scanned.- Specified by:
setRangein interfaceITokenScanner- Overrides:
setRangein classRuleBasedScanner- Parameters:
document- the document to scanoffset- the offset of the document range to scanlength- the length of the document range to scan
-
read
public int read()
Description copied from interface:ICharacterScannerReturns the next character or EOF if end of file has been reached- Specified by:
readin interfaceICharacterScanner- Overrides:
readin classRuleBasedScanner- Returns:
- the next character or EOF
-
unread
public void unread()
Description copied from interface:ICharacterScannerRewinds the scanner before the last read character.- Specified by:
unreadin interfaceICharacterScanner- Overrides:
unreadin classRuleBasedScanner
-
-