## org.apache.lucene.analysis
Class CharReader

    java.lang.Object
      java.io.Reader
          org.apache.lucene.analysis.CharStream
              org.apache.lucene.analysis.CharReader

All Implemented Interfaces:
  java.io.Closeable, java.lang.Readable

    public final class CharReader

extends CharStream

CharReader is a Reader wrapper. It reads chars from Reader and outputs `CharStream`, defining an identify function `correctOffset(int)` method that simply returns the provided offset.

Field Summary
`protected java.io.Reader` `input`

Fields inherited from class java.io.Reader
`lock`

Method Summary
`void` `close()`
`int` `correctOffset(int currentOff)` Called by CharFilter(s) and Tokenizer to correct token offset.
`static CharStream` `get(java.io.Reader input)`
`void` `mark(int readAheadLimit)`
`boolean` `markSupported()`
`int` `read(char[] cbuf, int off, int len)`
`void` `reset()`

Methods inherited from class java.io.Reader
`read, read, read, ready, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### input

    protected java.io.Reader input

Method Detail

### get

    public static CharStream get(java.io.Reader input)

### correctOffset

    public int correctOffset(int currentOff)

  Description copied from class: `CharStream`
  Called by CharFilter(s) and Tokenizer to correct token offset.

  Specified by:
    `correctOffset` in class `CharStream`
  Parameters:
    `currentOff` - offset as seen in the output
  Returns:
    corrected offset based on the input

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Specified by:
    `close` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### read

    public int read(char[] cbuf,
                    int off,
                    int len)
             throws java.io.IOException

  Specified by:
    `read` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### markSupported

    public boolean markSupported()

  Overrides:
    `markSupported` in class `java.io.Reader`

### mark

    public void mark(int readAheadLimit)
              throws java.io.IOException

  Overrides:
    `mark` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### reset

    public void reset()
               throws java.io.IOException

  Overrides:
    `reset` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.