Class MockReaderWrapper
Wraps a TextReader, and can throw random or fixed exceptions, and spoon feed read chars.
Implements
Inherited Members
Namespace: Lucene.Net.Analysis
Assembly: Lucene.Net.TestFramework.dll
Syntax
public class MockReaderWrapper : TextReader, IDisposable
Constructors
MockReaderWrapper(Random, TextReader)
Wraps a TextReader, and can throw random or fixed exceptions, and spoon feed read chars.
Declaration
public MockReaderWrapper(Random random, TextReader input)
Parameters
Type | Name | Description |
---|---|---|
Random | random | |
TextReader | input |
Methods
Dispose(bool)
Releases the unmanaged resources used by the TextReader and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
IsMyEvilException(Exception)
Wraps a TextReader, and can throw random or fixed exceptions, and spoon feed read chars.
Declaration
public static bool IsMyEvilException(Exception t)
Parameters
Type | Name | Description |
---|---|---|
Exception | t |
Returns
Type | Description |
---|---|
bool |
Read()
Reads the next character from the text reader and advances the character position by one character.
Declaration
public override int Read()
Returns
Type | Description |
---|---|
int | The next character from the text reader, or -1 if no more characters are available. The default implementation returns -1. |
Overrides
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The TextReader is closed. |
IOException | An I/O error occurs. |
Read(char[], int, int)
Reads a specified maximum number of characters from the current reader and writes the data to a buffer, beginning at the specified index.
Declaration
public override int Read(char[] cbuf, int off, int len)
Parameters
Type | Name | Description |
---|---|---|
char[] | cbuf | |
int | off | |
int | len |
Returns
Type | Description |
---|---|
int | The number of characters that have been read. The number will be less than or equal to |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException | The buffer length minus |
ArgumentOutOfRangeException |
|
ObjectDisposedException | The TextReader is closed. |
IOException | An I/O error occurs. |
ThrowExcAfterChar(int)
Throw an exception after reading this many chars.
Declaration
public virtual void ThrowExcAfterChar(int charUpto)
Parameters
Type | Name | Description |
---|---|---|
int | charUpto |
ThrowExcNext()
Wraps a TextReader, and can throw random or fixed exceptions, and spoon feed read chars.
Declaration
public virtual void ThrowExcNext()