Package lzma

Examples of lzma.LzmaEncoder


        ByteBuffer bbu = bb.duplicate();
        ByteBuffer bbc = ByteBuffer.allocateDirect(bbu.limit() + 13);
        bbc.order(ByteOrder.LITTLE_ENDIAN);
       
        LzmaEncoder enc = new LzmaEncoder();
        if (!enc.setLcLpPb(lc, lp, pb)) {
            throw new IOException("Invalid LZMA props");
        }
        if (!enc.setDictionarySize(dictSize)) {
            throw new IOException("Invalid dictionary size");
        }
        enc.setEndMarkerMode(true);
       
        bbc.put(enc.getCoderProperties());
        bbc.putLong(bbu.limit());
       
        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        executor.scheduleAtFixedRate(new ByteBufferProgress(bbu), 2, 2, TimeUnit.SECONDS);
       
        try {
            InputStream is = new ByteBufferInputStream(bbu);
            OutputStream os = new ByteBufferOutputStream(bbc);
            enc.code(is, os);
        } finally {
            executor.shutdown();
        }
       
        bbc.flip();
View Full Code Here

TOP

Related Classes of lzma.LzmaEncoder

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.