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

com.firefly.template.function.XmlEscapeFunction Maven / Gradle / Ivy

The newest version!
package com.firefly.template.function;

import java.io.OutputStream;

import com.firefly.template.Function;
import com.firefly.template.Model;
import com.firefly.utils.StringUtils;

public class XmlEscapeFunction implements Function {

	private String charset;

	public XmlEscapeFunction(String charset) {
		this.charset = charset;
	}

	@Override
	public void render(Model model, OutputStream out, Object... obj) throws Throwable {
		String str = (String)obj[0];
		out.write(StringUtils.escapeXML(str).getBytes(charset));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy