sk.baka.ikslibs.stream
Class PipedExceptionInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.PipedInputStream
          extended by sk.baka.ikslibs.stream.PipedExceptionInputStream
All Implemented Interfaces:
Closeable

public final class PipedExceptionInputStream
extends PipedInputStream

Functionally identical to PipedInputStream, except that when an exception is caught in the producer thread (the thread that writes data to associated PipedOutputStream) 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.PipedInputStream
buffer, in, out, PIPE_SIZE
 
Constructor Summary
PipedExceptionInputStream()
          Constructor.
PipedExceptionInputStream(PipedOutputStream src)
          Constructor.
 
Method Summary
 int read()
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.PipedInputStream
available, close, connect, receive
 
Methods inherited from class java.io.InputStream
mark, markSupported, 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

PipedExceptionInputStream

public PipedExceptionInputStream(PipedOutputStream src)
                          throws IOException
Constructor.

Parameters:
src - source.
Throws:
IOException

PipedExceptionInputStream

public PipedExceptionInputStream()
Constructor.

Method Detail

read

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

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class PipedInputStream
Throws:
IOException


Copyright © 2006 Martin Vysny - baka. All Rights Reserved.