Example usage for org.apache.commons.compress.archivers.tar TarUtils computeCheckSum

List of usage examples for org.apache.commons.compress.archivers.tar TarUtils computeCheckSum

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers.tar TarUtils computeCheckSum.

Prototype

public static long computeCheckSum(final byte[] buf) 

Source Link

Document

Compute the checksum of a tar entry header.

Usage

From source file:org.jclouds.docker.features.internal.ArchivesTest.java

@BeforeClass
private void init() throws IOException {
    tmpDir = Files.createTempDir();
    outputDir = Files.createTempDir();
    File sampleFile = writeSampleFile("test", "this is a test to tar a hierarchy of folders and files\n");
    checkSum = TarUtils.computeCheckSum(Files.asByteSource(sampleFile).read());
}

From source file:org.jclouds.docker.features.internal.ArchivesTest.java

public void testTarSingleFile() throws Exception {
    File archive = Archives.tar(tmpDir, new File(outputDir + File.separator + "test.tar.gz"));
    List<File> untarredFiles = unTar(archive, outputDir);
    File untarredSampleFile = getOnlyElement(untarredFiles, null);
    assertNotNull(untarredSampleFile);/* w  ww .  ja  v a 2s . com*/
    assertTrue(checkSum == TarUtils.computeCheckSum(Files.asByteSource(untarredSampleFile).read()));
}