C# Class Lucene.Net.Analysis.Util.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. At some point we might be able to make some readers accept streams (that are seekable) so this functionality can be .NET-ified.
Inheritance: Lucene.Net.Analysis.CharFilters.BaseCharFilter
Datei anzeigen Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
BufferedCharFilter ( TextReader @in ) : Lucene.Net.Analysis.CharFilters

Creates a buffering character-input stream that uses a default-sized input buffer.

BufferedCharFilter ( TextReader @in, int sz ) : Lucene.Net.Analysis.CharFilters

Creates a buffering character-input stream that uses an input buffer of the specified size.

Close ( ) : void
InitializeLifetimeService ( ) : object
Mark ( int readAheadLimit ) : void

Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point.

Peek ( ) : int
Read ( ) : int

Reads a single character.

Read ( char buffer, int index, int count ) : int

Reads characters into a portion of an array. This method implements the general contract of the corresponding read method of the Reader class. As an additional convenience, it attempts to read as many characters as possible by repeatedly invoking the read method of the underlying stream.This iterated read continues until one of the following conditions becomes true: The specified number of characters have been read, The read method of the underlying stream returns -1, indicating end-of-file, or The ready method of the underlying stream returns false, indicating that further input requests would block. If the first read on the underlying stream returns -1 to indicate end-of-file then this method returns -1. Otherwise this method returns the number of characters actually read. Subclasses of this class are encouraged, but not required, to attempt to read as many characters as possible in the same fashion. Ordinarily this method takes characters from this stream's character buffer, filling it from the underlying stream as necessary. If, however, the buffer is empty, the mark is not valid, and the requested length is at least as large as the buffer, then this method will read characters directly from the underlying stream into the given array. Thus redundant BufferedReaders will not copy data unnecessarily.

ReadAsync ( char buffer, int index, int count ) : Task
ReadBlock ( char buffer, int index, int count ) : int
ReadBlockAsync ( char buffer, int index, int count ) : Task
ReadLine ( ) : string

Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.

ReadLineAsync ( ) : Task
ReadToEnd ( ) : string
ReadToEndAsync ( ) : Task
Ready ( ) : bool

Tells whether this stream is ready to be read. A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready.

Reset ( ) : void

Resets the stream to the most recent mark.

Skip ( int n ) : long

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
EnsureOpen ( ) : void

Checks to make sure that the stream has not been closed

Fill ( ) : void

Fills the input buffer, taking the mark into account if it is valid.

Method Details

BufferedCharFilter() public method

Creates a buffering character-input stream that uses a default-sized input buffer.
public BufferedCharFilter ( TextReader @in ) : Lucene.Net.Analysis.CharFilters
@in TextReader
return Lucene.Net.Analysis.CharFilters

BufferedCharFilter() public method

Creates a buffering character-input stream that uses an input buffer of the specified size.
public BufferedCharFilter ( TextReader @in, int sz ) : Lucene.Net.Analysis.CharFilters
@in TextReader
sz int Input-buffer size
return Lucene.Net.Analysis.CharFilters

Close() public method

public Close ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

InitializeLifetimeService() public method

public InitializeLifetimeService ( ) : object
return object

Mark() public method

Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point.
public Mark ( int readAheadLimit ) : void
readAheadLimit int Limit on the number of characters that may be read while still preserving the mark. An attempt /// to reset the stream after reading characters up to this limit or beyond may fail. A limit value larger than the size of the /// input buffer will cause a new buffer to be allocated whose size is no smaller than limit. Therefore large values should be /// used with care.
return void

Peek() public method

public Peek ( ) : int
return int

Read() public method

Reads a single character.
If an I/O error occurs
public Read ( ) : int
return int

Read() public method

Reads characters into a portion of an array. This method implements the general contract of the corresponding read method of the Reader class. As an additional convenience, it attempts to read as many characters as possible by repeatedly invoking the read method of the underlying stream.This iterated read continues until one of the following conditions becomes true: The specified number of characters have been read, The read method of the underlying stream returns -1, indicating end-of-file, or The ready method of the underlying stream returns false, indicating that further input requests would block. If the first read on the underlying stream returns -1 to indicate end-of-file then this method returns -1. Otherwise this method returns the number of characters actually read. Subclasses of this class are encouraged, but not required, to attempt to read as many characters as possible in the same fashion. Ordinarily this method takes characters from this stream's character buffer, filling it from the underlying stream as necessary. If, however, the buffer is empty, the mark is not valid, and the requested length is at least as large as the buffer, then this method will read characters directly from the underlying stream into the given array. Thus redundant BufferedReaders will not copy data unnecessarily.
public Read ( char buffer, int index, int count ) : int
buffer char Destination buffer
index int Offset at which to start storing characters
count int Maximum number of characters to read
return int

ReadAsync() public method

public ReadAsync ( char buffer, int index, int count ) : Task
buffer char
index int
count int
return Task

ReadBlock() public method

public ReadBlock ( char buffer, int index, int count ) : int
buffer char
index int
count int
return int

ReadBlockAsync() public method

public ReadBlockAsync ( char buffer, int index, int count ) : Task
buffer char
index int
count int
return Task

ReadLine() public method

Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
If an I/O error occurs
public ReadLine ( ) : string
return string

ReadLineAsync() public method

public ReadLineAsync ( ) : Task
return Task

ReadToEnd() public method

public ReadToEnd ( ) : string
return string

ReadToEndAsync() public method

public ReadToEndAsync ( ) : Task
return Task

Ready() public method

Tells whether this stream is ready to be read. A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready.
public Ready ( ) : bool
return bool

Reset() public method

Resets the stream to the most recent mark.
If the stream has never been marked, or if the mark has been invalidated
public Reset ( ) : void
return void

Skip() public method

public Skip ( int n ) : long
n int
return long