public InputStream downloadStream(FTPFile fromFile) throws IOException, FtpWorkflowException, FtpIOException {
        
        PipedInputStream pis = new PipedInputStream();
        
        class DownStreamingThread extends Thread {
            FTPConnection connection;
            FTPFile fromFile;
            PipedInputStream pis;
            Exception caughtException;
            
            public DownStreamingThread(FTPConnection connection, FTPFile fromFile, PipedInputStream pis) {
                super();
                this.connection = connection;
                this.fromFile = fromFile;
                this.pis = pis;
            }
            
            /**
             * @return Returns the caughtException.
             */
            public Exception getCaughtException() {
                return caughtException;
            }
            
            /**
             * @param caughtException
             *            The caughtException to set.
             */
            public void setCaughtException(Exception caughtException) {
                this.caughtException = caughtException;
            }


            public void run() {
                try {
                    connection.streamFile(fromFile, pis);
                }catch(Exception e) {
                	setCaughtException(e);
                }
            }
        }
        
        DownStreamingThread downStreamingThread = new DownStreamingThread(this, fromFile, pis);
        downStreamingThread.start();

        // ensure that in/out pipes are connected already
        try {
        	for(int i=0; i<60 && pis.available() <= 0; i++)
        		Thread.sleep(1000);
        }catch(Exception e) {}
        
        //Check if in the Downloadthread a Exception occured
        if (downStreamingThread.getCaughtException()!=null){
            if (downStreamingThread.getCaughtException() instanceof IOException)
                throw (IOException)downStreamingThread.getCaughtException();
            if (downStreamingThread.getCaughtException() instanceof FtpWorkflowException)
                throw (FtpWorkflowException)downStreamingThread.getCaughtException();
            if (downStreamingThread.getCaughtException() instanceof FtpIOException)
                throw (FtpIOException)downStreamingThread.getCaughtException();
            //if other Exception occured.. should be ignored because then every LibraryUser has to modify
            //their source to catch other Exception types
            //so here only a printstacktrace
            downStreamingThread.getCaughtException().printStackTrace();
        }        
        return pis;
    }