class FastInfosetCompressionService implements CompressionService {

    @Override
    public ByteArrayOutputStream decompress(final InputStream inputStream) {
        StreamResult streamResult = streamResultFactory.createStreamResult();
        InputStream fiDocument = inputStream;
        ByteArrayOutputStream baos = outputStreamFactory.createByteArrayOutputStream();
        try {
            Transformer tx = fastInfosetTransformerFactory.createTransformer();
            tx.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
            tx.setOutputProperty(OutputKeys.INDENT, "yes");
            FastInfosetSource fastInfosetSource = fastInfosetSourceFactory.createFastInfosetSource(fiDocument);
            tx.transform(fastInfosetSource, streamResult);
            fiDocument.close();
            baos.write(streamResult.getWriter().toString().getBytes());
        } catch (TransformerFactoryConfigurationError | Exception e) {
            throw new SystemException("Could not perform fastinfoset decompression!", e);
        }
        return baos;
    }

}