Examples of LZFOutputStream


Examples of com.ning.compress.lzf.LZFOutputStream

        if (comp != null) {
            switch (comp) {
            case NONE:
                break;
            case LZF:
                return new LZFOutputStream(out);
            case GZIP:
                return new OptimizedGZIPOutputStream(out);
            default: // sanity check
                throw new IllegalArgumentException("Unrecognized compression type: "+comp);
            }
View Full Code Here

Examples of com.ning.compress.lzf.LZFOutputStream

    public void objectToEntry(final T info, DatabaseEntry entry) {

        FastOutputStream serialOutput = super.getSerialOutput(info);
        OutputStream out = serialOutput;
        if (compress) {
            out = new LZFOutputStream(serialOutput);
        }
        if (DEBUG) {
            out = new TeeOutputStream(out, System.out);
        }
        try {
View Full Code Here

Examples of org.elasticsearch.common.compress.lzf.LZFOutputStream

            try {
                File stateFile = new File(location, "metadata-" + version);
                OutputStream fos = new FileOutputStream(stateFile);
                if (compress) {
                    fos = new LZFOutputStream(fos);
                }
                LocalGatewayMetaState stateToWrite = builder.build();
                XContentBuilder xContentBuilder = XContentFactory.contentBuilder(XContentType.JSON, fos);
                if (prettyPrint) {
                    xContentBuilder.prettyPrint();
View Full Code Here

Examples of org.elasticsearch.common.compress.lzf.LZFOutputStream

        final String newMetaData = "metadata-" + (currentIndex + 1);
        try {
            FastByteArrayOutputStream out = new FastByteArrayOutputStream();
            OutputStream os = out;
            if (compress) {
                os = new LZFOutputStream(os);
            }
            XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON, os);
            builder.startObject();
            MetaData.Builder.toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
            builder.endObject();
View Full Code Here

Examples of org.elasticsearch.common.compress.lzf.LZFOutputStream

        @Override public void run() {
            try {
                File stateFile = new File(location, "shards-" + event.state().version());
                OutputStream fos = new FileOutputStream(stateFile);
                if (compress) {
                    fos = new LZFOutputStream(fos);
                }

                XContentBuilder xContentBuilder = XContentFactory.contentBuilder(XContentType.JSON, fos);
                if (prettyPrint) {
                    xContentBuilder.prettyPrint();
View Full Code Here

Examples of org.h2.compress.LZFOutputStream

    private void testLZFStreamClose() throws IOException {
        String fileName = getBaseDir() + "/temp";
        IOUtils.createDirs(fileName);
        OutputStream fo = IOUtils.openFileOutputStream(fileName, false);
        LZFOutputStream out = new LZFOutputStream(fo);
        out.write("Hello".getBytes());
        out.close();
        InputStream fi = IOUtils.openFileInputStream(fileName);
        LZFInputStream in = new LZFInputStream(fi);
        byte[] buff = new byte[100];
        assertEquals(5, in.read(buff));
        in.read();
View Full Code Here

Examples of org.h2.compress.LZFOutputStream

        Random random = new Random(1);
        int max = getSize(100, 1000);
        for (int i = 0; i < max; i += 3) {
            byte[] buffer = getRandomBytes(random);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            LZFOutputStream comp = new LZFOutputStream(out);
            if (random.nextInt(10) == 1) {
                comp.write(buffer);
            } else {
                for (int j = 0; j < buffer.length;) {
                    int[] sizes = { 0, 1, random.nextInt(100), random.nextInt(100000) };
                    int size = sizes[random.nextInt(sizes.length)];
                    size = Math.min(size, buffer.length - j);
                    if (size == 1) {
                        comp.write(buffer[j]);
                    } else {
                        comp.write(buffer, j, size);
                    }
                    j += size;
                }
            }
            comp.close();
            byte[] compressed = out.toByteArray();
            ByteArrayInputStream in = new ByteArrayInputStream(compressed);
            LZFInputStream decompress = new LZFInputStream(in);
            byte[] test = new byte[buffer.length];
            for (int j = 0; j < buffer.length;) {
View Full Code Here

Examples of org.h2.compress.LZFOutputStream

                z.putNextEntry(new ZipEntry(entryName));
                out = z;
            } else if ("DEFLATE".equals(compressionAlgorithm)) {
                out = new DeflaterOutputStream(out);
            } else if ("LZF".equals(compressionAlgorithm)) {
                out = new LZFOutputStream(out);
            } else if (compressionAlgorithm != null) {
                throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);
            }
            return out;
        } catch (IOException e) {
View Full Code Here

Examples of org.h2.compress.LZFOutputStream

                z.putNextEntry(new ZipEntry(entryName));
                out = z;
            } else if ("DEFLATE".equals(compressionAlgorithm)) {
                out = new DeflaterOutputStream(out);
            } else if ("LZF".equals(compressionAlgorithm)) {
                out = new LZFOutputStream(out);
            } else if (compressionAlgorithm != null) {
                throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);
            }
            return out;
        } catch (IOException e) {
View Full Code Here

Examples of org.lealone.compress.LZFOutputStream

                z.putNextEntry(new ZipEntry(entryName));
                out = z;
            } else if ("DEFLATE".equals(compressionAlgorithm)) {
                out = new DeflaterOutputStream(out);
            } else if ("LZF".equals(compressionAlgorithm)) {
                out = new LZFOutputStream(out);
            } else if (compressionAlgorithm != null) {
                throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);
            }
            return out;
        } catch (IOException e) {
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.