Class BufferedCharFilter
LUCENENET specific class to mimic Java's BufferedReader (that is, a reader that is seekable) so it supports Mark() and Reset() (which are part of the Java Reader class), but also provide the Correct() method of BaseCharFilter.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Util
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public class BufferedCharFilter : BaseCharFilter, IDisposable
Constructors
| Improve this Doc View SourceBufferedCharFilter(TextReader)
Creates a buffering character-input stream that uses a default-sized input buffer.
Declaration
public BufferedCharFilter(TextReader in)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextReader | in | A TextReader |
BufferedCharFilter(TextReader, Int32)
Creates a buffering character-input stream that uses an input buffer of the specified size.
Declaration
public BufferedCharFilter(TextReader in, int size)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextReader | in | A TextReader |
System.Int32 | size | Input-buffer size |
Fields
| Improve this Doc View SourceDEFAULT_CHAR_BUFFER_SIZE
Declaration
public const int DEFAULT_CHAR_BUFFER_SIZE = 8192
Field Value
Type | Description |
---|---|
System.Int32 |
m_lock
The object used to synchronize access to the reader.
Declaration
protected object m_lock
Field Value
Type | Description |
---|---|
System.Object |
Properties
| Improve this Doc View SourceIsMarkSupported
Indicates whether this reader supports the Mark(Int32) and
Reset() methods. This implementation returns true
.
Declaration
public override bool IsMarkSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
See Also
| Improve this Doc View SourceIsReady
Indicates whether this reader is ready to be read without blocking.
Declaration
public override bool IsReady { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
Methods
| Improve this Doc View SourceClose()
Declaration
public override void Close()
Overrides
Dispose(Boolean)
Disposes this reader. This implementation closes the buffered source reader and releases the buffer. Nothing is done if this reader has already been disposed.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if an error occurs while closing this reader. |
InitializeLifetimeService()
Declaration
public override object InitializeLifetimeService()
Returns
Type | Description |
---|---|
System.Object |
Overrides
Mark(Int32)
Sets a mark position in this reader. The parameter markLimit
indicates how many characters can be read before the mark is invalidated.
Calling Reset() will reposition the reader back to the marked
position if Lucene.Net.Analysis.Util.BufferedCharFilter.markLimit has not been surpassed.
Declaration
public override void Mark(int markLimit)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | markLimit | the number of characters that can be read before the mark is invalidated. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | if |
System.IO.IOException | if an error occurs while setting a mark in this reader. |
Peek()
Declaration
public override int Peek()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Read()
Reads a single character from this reader and returns it with the two higher-order bytes set to 0. If possible, BufferedCharFilter returns a character from the buffer. If there are no characters available in the buffer, it fills the buffer and then returns a character. It returns -1 if there are no more characters in the source reader.
Declaration
public override int Read()
Returns
Type | Description |
---|---|
System.Int32 | The character read or -1 if the end of the source reader has been reached. |
Overrides
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If this reader is disposed or some other I/O error occurs. |
Read(Char[], Int32, Int32)
Reads at most length
characters from this reader and stores them
at offset
in the character array buffer
. Returns the
number of characters actually read or -1 if the end of the source reader
has been reached. If all the buffered characters have been used, a mark
has not been set and the requested number of characters is larger than
this readers buffer size, BufferedReader bypasses the buffer and simply
places the results directly into buffer
.
Declaration
public override int Read(char[] buffer, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | buffer | the character array to store the characters read. |
System.Int32 | offset | the initial position in |
System.Int32 | length | the maximum number of characters to read, must be non-negative. |
Returns
Type | Description |
---|---|
System.Int32 | number of characters read or -1 if the end of the source reader has been reached. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | if |
System.IO.IOException | if this reader is disposed or some other I/O error occurs. |
ReadAsync(Char[], Int32, Int32)
Declaration
public override Task<int> ReadAsync(char[] buffer, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | buffer | |
System.Int32 | index | |
System.Int32 | count |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> |
Overrides
ReadBlock(Char[], Int32, Int32)
Declaration
public override int ReadBlock(char[] buffer, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | buffer | |
System.Int32 | index | |
System.Int32 | count |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
ReadBlockAsync(Char[], Int32, Int32)
Declaration
public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | buffer | |
System.Int32 | index | |
System.Int32 | count |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> |
Overrides
ReadLine()
Returns the next line of text available from this reader. A line is
represented by zero or more characters followed by '\n'
,
'\r'
, "\r\n"
or the end of the reader. The string does
not include the newline sequence.
Declaration
public override string ReadLine()
Returns
Type | Description |
---|---|
System.String | The contents of the line or |
Overrides
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if this reader is disposed or some other I/O error occurs. |
ReadLineAsync()
Declaration
public override Task<string> ReadLineAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
Overrides
ReadToEnd()
Declaration
public override string ReadToEnd()
Returns
Type | Description |
---|---|
System.String |
Overrides
ReadToEndAsync()
Declaration
public override Task<string> ReadToEndAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
Overrides
Reset()
Resets this reader's position to the last Mark(Int32) location. Invocations of Read() and Skip(Int32) will occur from this new location.
Declaration
public override void Reset()
Overrides
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If this reader is disposed or no mark has been set. |
See Also
| Improve this Doc View SourceSkip(Int32)
Skips amount
characters in this reader. Subsequent
Read()s will not return these characters unless Reset()
is used. Skipping characters may invalidate a mark if Lucene.Net.Analysis.Util.BufferedCharFilter.markLimit
is surpassed.
Declaration
public override long Skip(int amount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | amount | the maximum number of characters to skip. |
Returns
Type | Description |
---|---|
System.Int64 | the number of characters actually skipped. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | if |
System.IO.IOException | If this reader is disposed or some other I/O error occurs. |