Method Fill
Fill(CharacterUtils.CharacterBuffer, TextReader, Int32)
Fills the CharacterUtils.CharacterBuffer with characters read from the given reader System.IO.TextReader. This method tries to read
numChars
characters into the CharacterUtils.CharacterBuffer, each call to fill will start
filling the buffer from offset 0
up to numChars
.
In case code points can span across 2 java characters, this method may
only fill numChars - 1
characters in order not to split in
the middle of a surrogate pair, even if there are remaining characters in
the System.IO.TextReader.
Depending on the LuceneVersion passed to GetInstance(LuceneVersion) this method implements supplementary character awareness when filling the given buffer. For all LuceneVersion > 3.0 Fill(CharacterUtils.CharacterBuffer, TextReader, Int32) guarantees that the given CharacterUtils.CharacterBuffer will never contain a high surrogate character as the last element in the buffer unless it is the last available character in the reader. In other words, high and low surrogate pairs will always be preserved across buffer boarders.
A return value of false
means that this method call exhausted
the reader, but there may be some bytes which have been read, which can be
verified by checking whether buffer.Length > 0
.
Declaration
public abstract bool Fill(CharacterUtils.CharacterBuffer buffer, TextReader reader, int numChars)
Parameters
Type | Name | Description |
---|---|---|
CharacterUtils.CharacterBuffer | buffer | the buffer to fill. |
System.IO.TextReader | reader | the reader to read characters from. |
System.Int32 | numChars | the number of chars to read |
Returns
Type | Description |
---|---|
System.Boolean | if and only if reader.read returned -1 while trying to fill the buffer |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if the reader throws an System.IO.IOException. |
Fill(CharacterUtils.CharacterBuffer, TextReader)
Convenience method which calls Fill(buffer, reader, buffer.Buffer.Length)
.
Declaration
public virtual bool Fill(CharacterUtils.CharacterBuffer buffer, TextReader reader)
Parameters
Type | Name | Description |
---|---|---|
CharacterUtils.CharacterBuffer | buffer | |
System.IO.TextReader | reader |
Returns
Type | Description |
---|---|
System.Boolean |