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

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

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

import net.sourceforge.plantuml.zopfli.Options;
import net.sourceforge.plantuml.zopfli.Options.BlockSplitting;
import net.sourceforge.plantuml.zopfli.Options.OutputFormat;
import net.sourceforge.plantuml.zopfli.Zopfli;

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

	public byte[] compress(byte[] in) {
		if (in.length == 0)
			return null;

		int len = in.length * 2;
		if (len < 100)
			len = 100;

		final Zopfli compressor = new Zopfli(len);
		final Options options = new Options(OutputFormat.DEFLATE, BlockSplitting.FIRST, 30);

		return compressor.compress(options, in).getResult();
	}

	public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException {
		return new CompressionZlib().decompress(in);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy