Package com.alibaba.otter.node.etl.common.io.compress

Examples of com.alibaba.otter.node.etl.common.io.compress.Compressor


        try {
            byte[] data = getBlock(20 * 1024);
            byte[] result;
            for (int i = 0; i < comps.length; i++) {
                ByteArrayInputStream input = new ByteArrayInputStream(data);
                Compressor comp = comps[i];
                // 基于流的处理
                InputStream encrypt = comp.compress(input);
                InputStream decrypt = comp.decompress(encrypt);
                result = NioUtils.read(decrypt);
                check(data, result);
                encrypt.close();
                decrypt.close();
            }
View Full Code Here


    @Test
    public void test_block() {
        try {
            byte[] data = getBlock(20 * 1024);
            for (int i = 0; i < comps.length; i++) {
                Compressor comp = comps[i];
                // 基于流的处理
                byte[] encrypt = comp.compress(data);
                byte[] decrypt = comp.decompress(encrypt);
                check(data, decrypt);
            }

        } catch (Exception e) {
            want.fail();
View Full Code Here

            byte[] data = getBlock(20 * 1024);
            File input = File.createTempFile("compress_", "src");
            NioUtils.write(data, input);//写入数据到文件

            for (int i = 0; i < comps.length; i++) {
                Compressor comp = comps[i];
                // 基于流的处理
                File output = File.createTempFile("compress_", "jkt");
                comp.compressTo(input, output);

                Compressor icomp = (Compressor) PackableObject.identifyByHeader(output, Arrays.asList(comps));

                InputStream decrypt = icomp.decompress(output);
                byte[] result = NioUtils.read(decrypt);
                check(data, result);
            }

        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.alibaba.otter.node.etl.common.io.compress.Compressor

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.