Examples of LZMAOutputStream


Examples of com.emc.vipr.transform.compression.LZMAOutputStream

        File fin = new File(args[0]);
        File fout = new File(args[1]);
       
        try {
            FileInputStream fis = new FileInputStream(fin);
            LZMAOutputStream compOut = new LZMAOutputStream(new BufferedOutputStream(new FileOutputStream(fout)), 4);
           
            byte[] buffer = new byte[4096];
            int c = 0;
            while((c = fis.read(buffer)) != -1) {
                compOut.write(buffer, 0, c);
            }
           
            fis.close();
            compOut.close();
            compOut = null;
            Runtime.getRuntime().gc();
           
            System.out.printf("Done.  Input size %d compressed size %d\n", fin.length(), fout.length());
           
View Full Code Here

Examples of lzma.streams.LzmaOutputStream

    }

    private byte[] compress(byte[] data) throws Exception
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        LzmaOutputStream lzma = new LzmaOutputStream.Builder(out).useEndMarkerMode(true).build();
        lzma.write(data);
        lzma.close();
        return out.toByteArray();
    }
View Full Code Here

Examples of warrenfalk.lzma.LzmaOutputStream

    File test = new File("/dev/shm", fnonrand.getName() + ".lzma");
    File fin = new File("/dev/shm", fnonrand.getName() + ".final");
    long start = System.nanoTime();
    FileOutputStream fos = new FileOutputStream(test);
    FileInputStream fis = new FileInputStream(fnonrand);
    LzmaOutputStream los = new LzmaOutputStream(fos, -1, new byte[4096], 1 << 22, 3, 0, 2, 1 << 0x20);
    byte[] buffer = new byte[4096];
    int len;
    while (-1 != (len = fis.read(buffer, 0, buffer.length))) {
      los.write(buffer, 0, len);
    }
    fis.close();
    los.close();
    long end = System.nanoTime();
    System.out.println("" + ((double)(end - start) / 1000000000.0) + " seconds");
   
    start = System.nanoTime();
    fos = new FileOutputStream(fin);
View Full Code Here

Examples of warrenfalk.lzma.LzmaOutputStream

  public void testEncodeWithError() throws IOException {
    File test = new File("/dev/shm", fnonrand.getName() + ".lzma");
    long start = System.nanoTime();
    FileOutputStream fos = new FileOutputStream(test);
    InputStream fis = new FailInputStream(fnonrand);
    LzmaOutputStream los = new LzmaOutputStream(fos, -1, new byte[4096], 1 << 22, 3, 0, 2, 1 << 0x20);
    byte[] buffer = new byte[4096];
    int len;
    while (-1 != (len = fis.read(buffer, 0, buffer.length))) {
      los.write(buffer, 0, len);
    }
    fis.close();
    los.close();
    long end = System.nanoTime();
    System.out.println("" + ((double)(end - start) / 1000000000.0) + " seconds");
  }
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.