![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.plantuml.dedication.DedicationSimple Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.dedication;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.security.SFile;
public class DedicationSimple implements Dedication {
private final byte crypted[];
private final String sentence;
public DedicationSimple(byte crypted[], String sentence) {
this.crypted = crypted;
this.sentence = sentence;
}
public synchronized BufferedImage getImage(TinyHashableString sentence) {
if (same(this.sentence, sentence.getSentence()) == false)
return null;
try {
byte[] current = crypted.clone();
final RBlocks init = RBlocks.readFrom(current, 513);
final RBlocks decoded = init.change(E, N);
current = decoded.toByteArray(512);
return SFile.getBufferedImageFromWebpButHeader(new ByteArrayInputStream(current));
} catch (Throwable t) {
Logme.error(t);
return null;
}
}
private boolean same(String s1, String s2) {
s1 = s1.replaceAll("[^\\p{L}0-9]+", "");
s2 = s2.replaceAll("[^\\p{L}0-9]+", "");
return s1.equalsIgnoreCase(s2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy