org.apache.lucene.analysis
Class MockReaderWrapper

java.lang.Object
  extended by java.io.Reader
      extended by org.apache.lucene.analysis.MockReaderWrapper
All Implemented Interfaces:
Closeable, Readable

public class MockReaderWrapper
extends Reader

Wraps a Reader, and can throw random or fixed exceptions, and spoon feed read chars.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
MockReaderWrapper(Random random, Reader in)
           
 
Method Summary
 void close()
           
static boolean isMyEvilException(Throwable t)
           
 boolean markSupported()
           
 int read(char[] cbuf, int off, int len)
           
 boolean ready()
           
 void throwExcAfterChar(int charUpto)
          Throw an exception after reading this many chars.
 void throwExcNext()
           
 
Methods inherited from class java.io.Reader
mark, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockReaderWrapper

public MockReaderWrapper(Random random,
                         Reader in)
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:
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)


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.