Package com.netflix.priam.compress

Examples of com.netflix.priam.compress.SnappyCompression


    }

    @Test
    public void compress() throws FileNotFoundException, IOException
    {
        SnappyCompression compress = new SnappyCompression();
        RandomAccessFile file = new RandomAccessFile(new File("/tmp/compress-test.txt"), "r");
        long chunkSize = 5L*1024*1024;
        Iterator<byte[]> it = compress.compress(new AbstractBackupPath.RafInputStream(file), chunkSize);
        FileOutputStream ostream = new FileOutputStream("/tmp/test1.snp");
        while (it.hasNext())
        {
            byte[] chunk = it.next();
            ostream.write(chunk);
View Full Code Here


    }

    @Test
    public void decompress() throws FileNotFoundException, IOException
    {
        SnappyCompression compress = new SnappyCompression();
        compress.decompressAndClose(new FileInputStream("/tmp/test1.snp"), new FileOutputStream("/tmp/compress-test-out-2.txt"));
        String md1 = SystemUtils.md5(new File("/tmp/compress-test.txt"));
        String md2 = SystemUtils.md5(new File("/tmp/compress-test-out-2.txt"));
        assertEquals(md1, md2);
    }
View Full Code Here

TOP

Related Classes of com.netflix.priam.compress.SnappyCompression

Copyright © 2018 www.massapicom. 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.