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

liquibase.dbdoc.HTMLListWriter Maven / Gradle / Ivy

There is a newer version: 4.29.2
Show newest version
package liquibase.dbdoc;

import liquibase.GlobalConfiguration;
import liquibase.util.StringUtil;

import java.io.*;
import java.util.SortedSet;

public class HTMLListWriter {
    private File outputDir;
    private String directory;
    private String filename;
    private String title;

    public HTMLListWriter(String title, String filename, String subdir, File outputDir) {
        this.title = title;
        this.outputDir = outputDir;
        this.filename = filename;
        if (!outputDir.exists()) {
            outputDir.mkdir();
        }
        this.directory = subdir;
    }

    public void writeHTML(SortedSet objects) throws IOException {
        Writer fileWriter = new OutputStreamWriter(new FileOutputStream(new File(outputDir, filename)), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());

        try {
            fileWriter.append("\n" + "\n" + "\n");
            fileWriter.append(title);
            fileWriter.append("\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "");
            fileWriter.append(title);
            fileWriter.append("\n" + "
\n" + "" + "\n" + "\n" + "\n" + "
"); for (Object object : objects) { fileWriter.append(""); fileWriter.append(StringUtil.escapeHtml(object.toString())); fileWriter.append("
\n"); } fileWriter.append("
\n" + "\n" + "\n" + ""); } finally { fileWriter.close(); } } public String getTargetExtension() { return ".html"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy