private void streamFile(FTPFile fromFile, PipedInputStream pis) throws IOException, FtpWorkflowException, FtpIOException {
        
        setConnectionStatusLock(CSL_INDIRECT_CALL);
        setConnectionStatus(RECEIVING_FILE_STARTED, fromFile, null);
        setConnectionStatus(RECEIVING_FILE);

        RetrieveCommand command = new RetrieveCommand(Command.RETR, fromFile, pis);
        SocketProvider provider = null;

        if (getConnectionType() == FTPConnection.AUTH_SSL_FTP_CONNECTION
                || getConnectionType() == FTPConnection.AUTH_TLS_FTP_CONNECTION) {
            Command pbsz = new Command(Command.PBSZ, "0");
            (sendCommand(pbsz)).dumpReply();
            Command prot = new Command(Command.PROT, "P");
            (sendCommand(prot)).dumpReply();
        }
        
        // Send TYPE I
        Command commandType = new Command(connectionTransferType);
        (sendCommand(commandType)).dumpReply();
        Reply commandReply = new Reply();
        if (isPassiveMode()) {
            provider = initDataSocket(command, commandReply);
        } else {
            provider = sendPortCommand(command, commandReply);
        }
        
        this.setConnectionStatusLock(FTPConnection.CSL_INDIRECT_CALL);
        this.setConnectionStatus(FTPConnection.RECEIVING_FILE);

        command.setDataSocket(provider);
        // INFO response from ControllConnection is ignored
        try {
        	command.fetchDataConnectionReply(RetrieveCommand.STREAM_BASED);
        }catch(IOException ioe) {
            setConnectionStatus(ERROR);
            disconnect();
        	throw ioe;
        }
        if (commandReply.getLines().size() == 1) {
        	try {
        		Reply streamReply = ReplyWorker.readReply(socketProvider);
        		streamReply.dumpReply();
        		streamReply.validate();
            }catch(IOException ioe) {
                setConnectionStatus(ERROR);
                disconnect();
            	throw ioe;
            }
        }

        setConnectionStatus(RECEIVING_FILE_ENDED, fromFile, null);
        setConnectionStatus(IDLE);
        setConnectionStatusLock(CSL_DIRECT_CALL);
    }