Index: src/java/org/apache/lucene/analysis/CharReader.java =================================================================== --- src/java/org/apache/lucene/analysis/CharReader.java (revision 813488) +++ src/java/org/apache/lucene/analysis/CharReader.java (working copy) @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.lucene.analysis; - -import java.io.IOException; -import java.io.Reader; - -/** - * CharReader is a Reader wrapper. It reads chars from Reader and outputs CharStream. - * - * @version $Id$ - * - */ -public final class CharReader extends CharStream { - - protected Reader input; - - public static CharStream get(Reader input) { - return input instanceof CharStream ? - (CharStream)input : new CharReader(input); - } - - private CharReader(Reader in) { - input = in; - } - - public int correctOffset(int currentOff) { - return currentOff; - } - - public void close() throws IOException { - input.close(); - } - - public int read(char[] cbuf, int off, int len) throws IOException { - return input.read(cbuf, off, len); - } -} Index: src/java/org/apache/lucene/analysis/CharStream.java =================================================================== --- src/java/org/apache/lucene/analysis/CharStream.java (revision 813488) +++ src/java/org/apache/lucene/analysis/CharStream.java (working copy) @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.lucene.analysis; - -import java.io.Reader; - -/** - * CharStream adds correctOffset functionality over Reader. - * - * @version $Id$ - * - */ -public abstract class CharStream extends Reader { - - /** - * called by CharFilter(s) and Tokenizer to correct token offset. - * - * @param currentOff current offset - * @return corrected token offset - */ - public abstract int correctOffset( int currentOff ); -} Index: src/java/org/apache/lucene/analysis/standard/StandardTokenizer.java =================================================================== --- src/java/org/apache/lucene/analysis/standard/StandardTokenizer.java (revision 813488) +++ src/java/org/apache/lucene/analysis/standard/StandardTokenizer.java (working copy) @@ -22,8 +22,6 @@ import org.apache.lucene.analysis.Token; import org.apache.lucene.analysis.Tokenizer; -import org.apache.lucene.analysis.CharReader; -import org.apache.lucene.analysis.CharStream; /** A grammar-based tokenizer constructed with JFlex * @@ -88,10 +86,6 @@ */ private boolean replaceInvalidAcronym = false; - void setInput(Reader reader) { - this.input = CharReader.get(reader); - } - private int maxTokenLength = StandardAnalyzer.DEFAULT_MAX_TOKEN_LENGTH; /** Set the max allowed token length. Any token longer @@ -110,7 +104,7 @@ * input to a newly created JFlex scanner. */ public StandardTokenizer(Reader input) { - this.input = CharReader.get(input); + this.input = input; this.scanner = new StandardTokenizerImpl(input); } @@ -125,7 +119,7 @@ */ public StandardTokenizer(Reader input, boolean replaceInvalidAcronym) { this.replaceInvalidAcronym = replaceInvalidAcronym; - setInput(input); + this.input = input; this.scanner = new StandardTokenizerImpl(input); } @@ -184,7 +178,7 @@ } public void reset(Reader reader) throws IOException { - setInput(reader); + super.reset(reader); reset(); } Index: src/java/org/apache/lucene/analysis/Tokenizer.java =================================================================== --- src/java/org/apache/lucene/analysis/Tokenizer.java (revision 813488) +++ src/java/org/apache/lucene/analysis/Tokenizer.java (working copy) @@ -34,14 +34,14 @@ public abstract class Tokenizer extends TokenStream { /** The text source for this Tokenizer. */ - protected CharStream input; + protected Reader input; /** Construct a tokenizer with null input. */ protected Tokenizer() {} /** Construct a token stream processing the given input. */ protected Tokenizer(Reader input) { - this.input = CharReader.get(input); + this.input = input; } /** By default, closes the input Reader. */ @@ -53,7 +53,7 @@ * analyzer (in its reusableTokenStream method) will use * this to re-use a previously created tokenizer. */ public void reset(Reader input) throws IOException { - this.input = CharReader.get(input); + this.input = input; } }