18 using Lucene.Net.Analysis.Tokenattributes;
21 namespace Lucene.Net.Analysis
28 private const int DEFAULT_BUFFER_SIZE = 256;
31 private int finalOffset;
54 private void Init(
int bufferSize)
57 termAtt = AddAttribute<ITermAttribute>();
58 offsetAtt = AddAttribute<IOffsetAttribute>();
59 termAtt.ResizeTermBuffer(bufferSize);
62 public override bool IncrementToken()
69 char[] buffer = termAtt.TermBuffer();
72 int length = input.Read(buffer, upto, buffer.Length - upto);
76 if (upto == buffer.Length)
77 buffer = termAtt.ResizeTermBuffer(1 + buffer.Length);
79 termAtt.SetTermLength(upto);
80 finalOffset = CorrectOffset(upto);
81 offsetAtt.SetOffset(CorrectOffset(0), finalOffset);
87 public override void End()
90 offsetAtt.SetOffset(finalOffset, finalOffset);
93 public override void Reset(System.IO.TextReader input)