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

net.sourceforge.plantuml.code.CompressionBrotli Maven / Gradle / Ivy

There is a newer version: 1.2025.0
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.code;

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

import net.sourceforge.plantuml.FileUtils;
import net.sourceforge.plantuml.brotli.BrotliInputStream;
import net.sourceforge.plantuml.log.Logme;

public class CompressionBrotli implements Compression {
	// ::remove file when __CORE__

	public byte[] compress(byte[] in) {
		throw new UnsupportedOperationException();
	}

	public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException {
		try (final BrotliInputStream brotli = new BrotliInputStream(new ByteArrayInputStream(in));
				final ByteArrayOutputStream result = new ByteArrayOutputStream();) {
			FileUtils.copyToStream(brotli, result);
			return ByteArray.from(result.toByteArray());
		} catch (IOException e) {
			Logme.error(e);
			throw new NoPlantumlCompressionException(e);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy