public String export(OutputStream os, XWikiContext context) throws IOException, XWikiException { if (this.files.size() == 0) { return "No Selected file"; } ZipArchiveOutputStream zos = new ZipArchiveOutputStream(os); zos.setEncoding(XAR_FILENAME_ENCODING); // By including the unicode extra fields, it is possible to extract XAR-files // containing documents with non-ascii characters in the document name using InfoZIP, // and the filenames will be correctly converted to the character set of the local // file system. zos.setCreateUnicodeExtraFields(ZipArchiveOutputStream.UnicodeExtraFieldPolicy.ALWAYS); for (int i = 0; i < this.files.size(); i++) { DocumentInfo docinfo = this.files.get(i); XWikiDocument doc = docinfo.getDoc(); addToZip(doc, zos, this.withVersions, context); } addInfosToZip(zos, context); zos.finish(); zos.flush(); return ""; }