Example usage for java.util.zip InflaterOutputStream write

List of usage examples for java.util.zip InflaterOutputStream write

Introduction

In this page you can find the example usage for java.util.zip InflaterOutputStream write.

Prototype

public void write(byte[] b, int off, int len) throws IOException 

Source Link

Document

Writes an array of bytes to the uncompressed output stream.

Usage

From source file:de.tntinteractive.portalsammler.engine.SecureStore.java

public byte[] getDocument(final DocumentInfo metadata) throws IOException {
    final Map<String, String> pointer = this.index.getFilePosition(metadata);
    final byte[] buffer = this.readAndDecrypt(pointer.get("f"));
    final int offset = Integer.parseInt(pointer.get("o"));
    final int size = Integer.parseInt(pointer.get("s"));

    final ByteArrayOutputStream result = new ByteArrayOutputStream();
    final InflaterOutputStream inflate = new InflaterOutputStream(result);
    inflate.write(buffer, offset, size);
    inflate.close();/*from w  w  w  .  j av a 2 s.c o m*/

    return result.toByteArray();
}