private boolean sendData(BufferedInputStream bis, StageContext ctx) {
        
        final TextConnection c = new TextConnection(ctx.getConnection());
        Integer pos = (Integer) ctx.getParameter("position");
        if (pos == null) {
            pos = 0;
        }
        
        if (pos == 0) {
            try {
                c.writeText("HTTP/1.1 200 OK");
                c.writeText(Constants.CRLF);
                c.writeText(Constants.CRLF);
        
            } catch (Exception ex) {
                if (bis != null) {
                    try {
                        bis.close();
                    } catch (IOException ex2) {
                        LOGGER.error("cannot close file input stream");
                    }
                }

                LOGGER.info("cannot write headers - " + ex.getMessage());
                return true;
            }
        }

        try {
            final byte[] b = getReadBuffer(ctx);
            bis.skip(pos);
            final int len = bis.read(b);
            
            if (len >= 0) {
                final int writeLen = c.write(ByteBuffer.wrap(b, 0, len));
                pos += writeLen;
                ctx.setParameter("position", pos);
                return false;
            } 
        } catch (IOException iOException) {
            LOGGER.error("cannot read file - " + iOException.getMessage());
        } catch (ConnectionException connectionException) {
            LOGGER.error("cannot write data - " + connectionException.getMessage());
        }
        
        return true;
    }