os.close();  response.flushBuffer();
    public Sequence eval(Sequence[] args, Sequence contextSequence)            throws XPathException {        if (args[0].getLength() == 0)            return Sequence.EMPTY_SEQUENCE;        Base64Binary binary = (Base64Binary) args[0].itemAt(0);        String contentType = args[1].getStringValue();                ResponseModule myModule = (ResponseModule)context.getModule(ResponseModule.NAMESPACE_URI);        // request object is read from global variable $request        Variable respVar = myModule.resolveVariable(ResponseModule.RESPONSE_VAR);        if(respVar == null)            throw new XPathException(getASTNode(), "No request object found in the current XQuery context.");        if(respVar.getValue().getItemType() != Type.JAVA_OBJECT)            throw new XPathException(getASTNode(), "Variable $response is not bound to an Java object.");        JavaObjectValue respValue = (JavaObjectValue)            respVar.getValue().itemAt(0);        if (!"org.exist.http.servlets.HttpResponseWrapper".equals(respValue.getObject().getClass().getName()))            throw new XPathException(getASTNode(), signature.toString() +                     " can only be used within the EXistServlet or XQueryServlet");        ResponseWrapper response = (ResponseWrapper) respValue.getObject();        response.setHeader("Content-Type", contentType);        try {            OutputStream os = new BufferedOutputStream(response.getOutputStream());            os.write(binary.getBinaryData());        } catch (IOException e) {            throw new XPathException(getASTNode(), "IO exception while streaming data: " + e.getMessage(), e);        }        return Sequence.EMPTY_SEQUENCE;    }