org.jsoup.helper.KeyVal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of html2pdf Show documentation
Show all versions of html2pdf Show documentation
pdfHTML is an iText add-on that lets you to parse (X)HTML snippets and the associated CSS and converts
them to PDF.
package org.jsoup.helper;
import java.io.InputStream;
public class KeyVal {
private String key;
private String value;
private InputStream stream;
public static KeyVal create(String key, String value) {
return (KeyVal) new KeyVal().key(key).value(value);
}
public static KeyVal create(String key, String filename, InputStream stream) {
return (KeyVal) new KeyVal().key(key).value(filename).inputStream(stream);
}
private KeyVal() {}
public KeyVal key(String key) {
Validate.notEmpty(key, "Data key must not be empty");
this.key = key;
return this;
}
public String key() {
return key;
}
public KeyVal value(String value) {
Validate.notNull(value, "Data value must not be null");
this.value = value;
return this;
}
public String value() {
return value;
}
public KeyVal inputStream(InputStream inputStream) {
Validate.notNull(value, "Data input stream must not be null");
this.stream = inputStream;
return this;
}
public InputStream inputStream() {
return stream;
}
public boolean hasInputStream() {
return stream != null;
}
@Override
public String toString() {
return key + "=" + value;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy