Examples of LZFFileOutputStream


Examples of com.ning.compress.lzf.util.LZFFileOutputStream

        System.out.printf("(writing as file '%s')\n", out.getPath());
       
        byte[] buffer = new byte[4000];
        int count;
        FileInputStream ins = new FileInputStream(in);
        LZFFileOutputStream outs = new LZFFileOutputStream(out);
       
        while ((count = ins.read(buffer)) > 0) {
            outs.write(buffer, 0, count);
        }
        ins.close();
        outs.close();
        System.out.printf("Compressed as file '%s', %d bytes\n", out.getPath(), out.length());

        new ManualSkipComparison().test(out, (int) in.length());
    }
View Full Code Here

Examples of com.ning.compress.lzf.util.LZFFileOutputStream

                if (compress) {
                    int inputLength = 0;
                    File resultFile = new File(filename+SUFFIX);
                    InputStream in = new FileInputStream(src);
                    OutputStream out = new LZFFileOutputStream(resultFile);
                    byte[] buffer = new byte[8192];
                    int bytesRead;
                    while ((bytesRead = in.read(buffer, 0, buffer.length)) != -1) {
                        inputLength += bytesRead;
                        out.write(buffer, 0, bytesRead);
                    }
                    in.close();
                    out.flush();
                    out.close();
                    System.out.printf("Compressed '%s' into '%s' (%d->%d bytes)\n",
                            src.getPath(), resultFile.getPath(),
                            inputLength, resultFile.length());
                } else {
                    OutputStream out;
                    LZFFileInputStream in = new LZFFileInputStream(src);
                    File resultFile = null;
                    if (toSystemOutput) {
                        out = System.out;
                    } else {
                        resultFile = new File(filename.substring(0, filename.length() - SUFFIX.length()));
                        out = new FileOutputStream(resultFile);
                    }
                    int uncompLen = in.readAndWrite(out);
                    in.close();
                    out.flush();
                    out.close();
                    if (resultFile != null) {
                        System.out.printf("Uncompressed '%s' into '%s' (%d->%d bytes)\n",
                                src.getPath(), resultFile.getPath(),
                                src.length(), uncompLen);
                    }
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.