sk.uniba.euromath.tools.io
Class PipedExceptionReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.PipedReader
          extended by sk.uniba.euromath.tools.io.PipedExceptionReader
All Implemented Interfaces:
Closeable, Readable

public final class PipedExceptionReader
extends PipedReader

Functionally identical to PipedReader, except that when an exception is caught in the producer thread (the thread that writes data to associated PipedWriter) and it is registered in the registry then all read() methods will fail with the registered exception. For further details please see the documentation of ExceptionRegistry.

Author:
Martin Vysny

Field Summary
 ExceptionRegistry registry
          If exception in producer occurs then record it here before thread termination.
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
PipedExceptionReader()
          Constructor.
PipedExceptionReader(PipedWriter src)
          Constructor.
 
Method Summary
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.PipedReader
close, connect, ready
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

registry

public final ExceptionRegistry registry
If exception in producer occurs then record it here before thread termination. It will then be linked as cause of exception thrown by all read() methods.

Constructor Detail

PipedExceptionReader

public PipedExceptionReader()
Constructor.


PipedExceptionReader

public PipedExceptionReader(PipedWriter src)
                     throws IOException
Constructor.

Parameters:
src - source.
Throws:
IOException
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class PipedReader
Throws:
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Overrides:
read in class PipedReader
Throws:
IOException


Copyright 2003-2003-2006 null. All Rights Reserved.