Search in sources :

Example 1 with XorOutputStream

use of net.sourceforge.processdash.util.XorOutputStream in project processdash by dtuma.

the class RedactFilterer method doFilter.

public void doFilter(File src, File dest) throws IOException {
    OutputStream out = new XorOutputStream(new BufferedOutputStream(new FileOutputStream(dest)), CompressedInstanceLauncher.PDASH_BACKUP_XOR_BITS);
    doFilter(src, out);
    out.close();
}
Also used : OutputStream(java.io.OutputStream) ZipOutputStream(java.util.zip.ZipOutputStream) XorOutputStream(net.sourceforge.processdash.util.XorOutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) XorOutputStream(net.sourceforge.processdash.util.XorOutputStream) BufferedOutputStream(java.io.BufferedOutputStream)

Example 2 with XorOutputStream

use of net.sourceforge.processdash.util.XorOutputStream in project processdash by dtuma.

the class CompressedWorkingDirectory method flushData.

public boolean flushData() throws LockFailureException, IOException {
    List<String> filesToBackup = FileUtils.listRecursively(extractDirectory, CWD_FILE_FILTER);
    File destZip = getTargetZipFile();
    RobustFileOutputStream rOut = new RobustFileOutputStream(destZip);
    OutputStream out = rOut;
    if (isPdbk(destZip))
        out = new XorOutputStream(out, PDBK_XOR_BITS);
    try {
        ZipOutputStream zipOut = new ZipOutputStream(new BufferedOutputStream(out));
        for (String filename : filesToBackup) {
            File f = new File(extractDirectory, filename);
            ZipEntry e = new ZipEntry(filename);
            e.setTime(f.lastModified());
            zipOut.putNextEntry(e);
            FileUtils.copyFile(f, zipOut);
            zipOut.closeEntry();
        }
        zipOut.finish();
        zipOut.flush();
    } catch (IOException ioe) {
        rOut.abort();
        throw ioe;
    }
    out.close();
    return true;
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ZipOutputStream(java.util.zip.ZipOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) OutputStream(java.io.OutputStream) RobustFileOutputStream(net.sourceforge.processdash.util.RobustFileOutputStream) XorOutputStream(net.sourceforge.processdash.util.XorOutputStream) ZipEntry(java.util.zip.ZipEntry) RobustFileOutputStream(net.sourceforge.processdash.util.RobustFileOutputStream) XorOutputStream(net.sourceforge.processdash.util.XorOutputStream) IOException(java.io.IOException) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream)

Aggregations

BufferedOutputStream (java.io.BufferedOutputStream)2 OutputStream (java.io.OutputStream)2 ZipOutputStream (java.util.zip.ZipOutputStream)2 XorOutputStream (net.sourceforge.processdash.util.XorOutputStream)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ZipEntry (java.util.zip.ZipEntry)1 RobustFileOutputStream (net.sourceforge.processdash.util.RobustFileOutputStream)1