edu.emory.mathcs.util.io
Interface TimedRedirectibleInput

All Superinterfaces:
Input, RedirectibleInput, TimedInput

public interface TimedRedirectibleInput
extends TimedInput, RedirectibleInput

Input source that is both redirectible and supports timeout read.

Version:
1.0
Author:
Dawid Kurzyniec

Method Summary
 int timedRedirect(java.io.OutputStream dest, int len, long timeout)
          Reads with timeout and redirects up to the len bytes of data to a specified output stream.
 
Methods inherited from interface edu.emory.mathcs.util.io.TimedInput
timedRead, timedRead, timedRead
 
Methods inherited from interface edu.emory.mathcs.util.io.Input
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from interface edu.emory.mathcs.util.io.RedirectibleInput
redirect, redirectAll
 

Method Detail

timedRedirect

public int timedRedirect(java.io.OutputStream dest,
                         int len,
                         long timeout)
                  throws java.io.IOException,
                         TimeoutException
Reads with timeout and redirects up to the len bytes of data to a specified output stream. Returns the number of bytes actually redirected. If nonzero bytes is requested but no data is available within the specified timeout and the stream is not at EOF, TimeoutException is thrown.

Parameters:
dest - the destination stream
len - the maximum number of bytes to redirect
timeout - the maximum number of milliseconds to wait before data is available
Returns:
number of bytes actually redirected
Throws:
java.io.IOException - if IOException occurs
TimeoutException - if timeout occurs before data is available