Package org.apache.lucene.tests.analysis
Class MockReaderWrapper
- java.lang.Object
-
- java.io.Reader
-
- org.apache.lucene.tests.analysis.MockReaderWrapper
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
public class MockReaderWrapper extends Reader
Wraps a Reader, and can throw random or fixed exceptions, and spoon feed read chars.
-
-
Constructor Summary
Constructors Constructor Description MockReaderWrapper(Random random, Reader in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static booleanisMyEvilException(Throwable t)booleanmarkSupported()intread(char[] cbuf, int off, int len)booleanready()voidthrowExcAfterChar(int charUpto)Throw an exception after reading this many chars.voidthrowExcNext()-
Methods inherited from class java.io.Reader
mark, nullReader, read, read, read, reset, skip, transferTo
-
-
-
-
Method Detail
-
throwExcAfterChar
public void throwExcAfterChar(int charUpto)
Throw an exception after reading this many chars.
-
throwExcNext
public void throwExcNext()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
read
public int read(char[] cbuf, int off, int len) throws IOException- Specified by:
readin classReader- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classReader
-
isMyEvilException
public static boolean isMyEvilException(Throwable t)
-
-