All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dellroad.lzma.client.LZMAByteArrayDecompressor Maven / Gradle / Ivy

Go to download

gwt-lzma is a GWT module that implements the Lempel-Ziv-Markov chain (LZMA) compression algorithm. This is a generic compression library, i.e., compression in Javascript, not just compression of Javascript (i.e., "minification").

There is a newer version: 1.2-8
Show newest version

/*
 * Copyright (C) 2009 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

package org.dellroad.lzma.client;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * LZMA decompressor for {@code byte[]} arrays.
 */
public class LZMAByteArrayDecompressor extends LZMADecompressor {

    private final ByteArrayOutputStream output;

    /**
     * Constructor.
     *
     * @param data compressed data
     * @throws IOException if the compressed data is truncated or corrupted
     */
    public LZMAByteArrayDecompressor(byte[] data) throws IOException {
        this.output = new ByteArrayOutputStream();
        init(new ByteArrayInputStream(data), this.output);
    }

    /**
     * Get the uncompressed data.
     */
    public byte[] getUncompressedData() {
        return this.output.toByteArray();
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy