Webiyo

This page was generated using Webiyo. See its source code and unit tests.

org/webiyo/xml/CharEntity.java

package org.webiyo.xml;

import org.webiyo.web.HtmlWriter;
import org.webiyo.web.Renderable;

import java.io.IOException;

public class CharEntity implements Renderable {

    private final String name;
    private final char codePoint;

    public CharEntity(String name, char codePoint) {
        this.name = name;
        this.codePoint = codePoint;
    }

    public char getCodePoint() {
        return codePoint;
    }

    public String getDeclaration() {
        return "<!ENTITY " + name + " \"&#" + (int) codePoint + ";\">";
    }

    public void render(HtmlWriter out) throws IOException {
        out.entity(name);
    }


}
SourceForge