protected void exportPage(WikiEngine engine, Attachment att) throws IOException, ProviderException { exportPageHeader(att.getName(), att.getWiki(), att.getAuthor(), att.getLastModified(), true); m_out.println(" <sv:property sv:name='" + att.getFileName() + "' sv:type='" + BINARY + "'>"); m_out.print("<sv:value>"); InputStream binary = engine.getAttachmentManager().getAttachmentStream(att); Base64.InputStream base64 = new Base64.InputStream(binary, Base64.ENCODE); FileUtil.copyContents(new InputStreamReader(base64), m_out); binary.close(); m_out.println("</sv:value>"); m_out.println("</sv:property>"); exportPageFooter(); }
protected void export(String dir) throws IOException { System.out.println( "Exporting a FileSystemProvider/RCSFileProvider/VersioningFileProvider compatible repository."); System.out.println( "This version does not export attributes, ACLs or attachments. Please use --properties for that."); File df = new File(dir); File[] pages = df.listFiles( new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(FileSystemProvider.FILE_EXT); } }); exportDocumentHeader(); for (File f : pages) { String pageName = f.getName(); pageName = pageName.replace(".txt", ""); exportPageHeader(pageName, "Main", "TBD", new Date(f.lastModified()), false); // File content FileInputStream in = new FileInputStream(f); exportProperty("wiki:content", FileUtil.readContents(in, "UTF-8"), STRING); in.close(); exportPageFooter(); } exportDocumentFooter(); System.out.println("...done"); }