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 Details

    • MockReaderWrapper

      public MockReaderWrapper(Random random, Reader in)
  • Method Details

    • 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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class Reader
      Throws:
      IOException
    • read

      public int read(char[] cbuf, int off, int len) throws IOException
      Specified by:
      read in class Reader
      Throws:
      IOException
    • markSupported

      public boolean markSupported()
      Overrides:
      markSupported in class Reader
    • ready

      public boolean ready()
      Overrides:
      ready in class Reader
    • isMyEvilException

      public static boolean isMyEvilException(Throwable t)