Examples of RobustFileOutputStream


Examples of net.sourceforge.processdash.util.RobustFileOutputStream

    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;
View Full Code Here

Examples of net.sourceforge.processdash.util.RobustFileOutputStream

        List<String> files = FileUtils.listRecursively(sourceDir,
            DashboardInstanceStrategy.INSTANCE.getFilenameFilter());
        for (String filename : files) {
            File srcFile = new File(sourceDir, filename);
            File destFile = new File(destDir, filename);
            RobustFileOutputStream out = new RobustFileOutputStream(destFile);
            FileUtils.copyFile(srcFile, out);
            out.close();
        }
    }
View Full Code Here

Examples of net.sourceforge.processdash.util.RobustFileOutputStream

    private static final String NEWLINE = System.getProperty("line.separator");

    public static void write(File f, Iterator timeLogEntries)
            throws IOException {
        write(new RobustFileOutputStream(f), timeLogEntries, true);
    }
View Full Code Here

Examples of net.sourceforge.processdash.util.RobustFileOutputStream

        target = serverUrl;
    }

    private void copyToDestFile(long checksum) throws IOException {
        RobustFileOutputStream out = new RobustFileOutputStream(directFile,
                false);
        FileUtils.copyFile(tempOutFile, out);
        long copySum = out.getChecksum();
        if (copySum == checksum) {
            out.close();
            target = directFile;
        } else {
            out.abort();
            throw new IOException("Error writing to " + directFile
                    + " - checksums do not match");
        }
    }
View Full Code Here

Examples of net.sourceforge.processdash.util.RobustFileOutputStream

    }

    private void writeFile() throws IOException {
        try {
            Writer out = new OutputStreamWriter(new BufferedOutputStream(
                    new RobustFileOutputStream(file, false)), "UTF-8");
            out.write("<?xml version='1.0' encoding='UTF-8'?>\r\n\r\n");
            out.write("<" + SERVER_DOCUMENT_TAG + ">\r\n");
            for (ServerEntry se : serverEntries.values()) {
                se.getAsXML(out);
            }
View Full Code Here

Examples of net.sourceforge.processdash.util.RobustFileOutputStream

    }
  }
 
  private void saveAsXML(Defect [] defects) {
      try {
          RobustFileOutputStream out = new RobustFileOutputStream(
                    defectLogFilename);
          if (defects != null && defects.length > 0) {
              XmlSerializer ser = XMLUtils.getXmlSerializer(true);
              ser.setOutput(out, XmlConstants.ENCODING);
              ser.startDocument(XmlConstants.ENCODING, null);
              ser.startTag(null, "defectLog");
              for (int i = 0; i < defects.length; i++)
                  if (defects[i] != null)
                      defects[i].toXml(ser);
              ser.endTag(null, "defectLog");
              ser.endDocument();
          }
          out.close();

      } catch (IOException e) { System.out.println("IOException: " + e); };
  }
View Full Code Here

Examples of net.sourceforge.processdash.util.RobustFileOutputStream

        // abort.
        if (!baseDirectory.isDirectory() && !baseDirectory.mkdirs())
            return null;
       
        File f = getFile(filename);
        RobustFileOutputStream out = new RobustFileOutputStream(f);
        return out;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.