FileDocCategorySizeDatePackage
ProcessStreamDrainerWorker.javaAPI DocGlassfish v2 API3010Fri May 04 22:32:14 BST 2007com.sun.enterprise.util.io

ProcessStreamDrainerWorker

public class ProcessStreamDrainerWorker extends Object implements Runnable

Fields Summary
private final BufferedInputStream
reader
private final PrintStream
redirect
Constructors Summary
ProcessStreamDrainerWorker(InputStream in)

        this(in, null);
    
ProcessStreamDrainerWorker(InputStream in, PrintStream Redirect)

        if(in == null)
            throw new NullPointerException("InputStream argument was null.");
        
        reader = new BufferedInputStream(in);
        redirect = Redirect;
    
Methods Summary
public voidrun()

        if(reader == null)
            return;
        
        try
        {
            int count = 0;
            byte[] buffer = new byte[4096];
            
            while ((count = reader.read(buffer)) != -1)
            {
                if(redirect != null)
                    redirect.write(buffer, 0, count);
            }
        } 
        catch (IOException e)
        {
        }