Example usage for java.util.zip InflaterOutputStream close

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

Introduction

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

Prototype

public void close() throws IOException 

Source Link

Document

Writes any remaining uncompressed data to the output stream and closes the underlying output stream.

Usage

From source file:de.siegmar.logbackgelf.GelfUdpAppenderTest.java

private JsonNode receiveCompressedMessage() throws IOException {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    final InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(bos);

    inflaterOutputStream.write(server.getReceivedData());
    inflaterOutputStream.close();

    return new ObjectMapper().readTree(bos.toByteArray());
}

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();

    return result.toByteArray();
}

From source file:org.xlcloud.console.saml2.Saml2ServiceProviderConsumerServlet.java

private byte[] inflate(byte[] responseBytes) throws IOException {
    Inflater inflater = new Inflater(true);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    InflaterOutputStream ios = new InflaterOutputStream(out, inflater);

    ios.write(responseBytes);//from  w w  w  .  j  a  va2  s . co m
    ios.close();
    return out.toByteArray();
}