Search in sources :

Example 41 with Adler32

use of java.util.zip.Adler32 in project processdash by dtuma.

the class MoveProjectWorker method copyFile.

private void copyFile(File oldFile, File newFile) throws MoveProjectException {
    try {
        FileUtils.copyFile(oldFile, newFile);
        long oldSum = FileUtils.computeChecksum(oldFile, new Adler32());
        long newSum = FileUtils.computeChecksum(newFile, new Adler32());
        if (oldSum == newSum)
            return;
    } catch (IOException e) {
    }
    throw new MoveProjectException(MoveProjectWizard.NEWDIR_URI, "cannotCreateFile").append("oldPath", oldFile.getPath()).append("path", newFile.getPath());
}
Also used : IOException(java.io.IOException) Adler32(java.util.zip.Adler32)

Aggregations

Adler32 (java.util.zip.Adler32)41 IOException (java.io.IOException)11 Checksum (java.util.zip.Checksum)9 ByteBuffer (java.nio.ByteBuffer)8 FileInputStream (java.io.FileInputStream)7 InputStream (java.io.InputStream)6 CheckedInputStream (java.util.zip.CheckedInputStream)6 BufferedInputStream (java.io.BufferedInputStream)5 File (java.io.File)5 BinaryInputArchive (org.apache.jute.BinaryInputArchive)5 InputArchive (org.apache.jute.InputArchive)4 EOFException (java.io.EOFException)3 OutputStream (java.io.OutputStream)3 CheckedOutputStream (java.util.zip.CheckedOutputStream)3 BufferedOutputStream (java.io.BufferedOutputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 FileOutputStream (java.io.FileOutputStream)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2