Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
16   58   6   5.33
4   31   0.38   3
3     2  
1    
 
  KeywordTokenizer       Line # 25 16 6 100% 1.0
 
  (1)
 
1    package org.apache.lucene.analysis;
2   
3    /**
4    * Copyright 2004-2005 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    import java.io.IOException;
20    import java.io.Reader;
21   
22    /**
23    * Emits the entire input as a single token.
24    */
 
25    public class KeywordTokenizer extends Tokenizer {
26   
27    private static final int DEFAULT_BUFFER_SIZE = 256;
28   
29    private boolean done;
30    private final char[] buffer;
31   
 
32  1 toggle public KeywordTokenizer(Reader input) {
33  1 this(input, DEFAULT_BUFFER_SIZE);
34    }
35   
 
36  1 toggle public KeywordTokenizer(Reader input, int bufferSize) {
37  1 super(input);
38  1 this.buffer = new char[bufferSize];
39  1 this.done = false;
40    }
41   
 
42  2 toggle public Token next() throws IOException {
43  2 if (!done) {
44  1 done = true;
45  1 StringBuffer buffer = new StringBuffer();
46  1 int length;
47  1 while (true) {
48  2 length = input.read(this.buffer);
49  2 if (length == -1) break;
50   
51  1 buffer.append(this.buffer, 0, length);
52    }
53  1 String text = buffer.toString();
54  1 return new Token(text, 0, text.length());
55    }
56  1 return null;
57    }
58    }