⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writehtml.java

📁 jsp开发常用信息管理系统适合初学者学习 新闻管理
💻 JAVA
字号:
/*
 * 创建日期 2007-1-13
 */
package ch06.html.utils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author <a href="chengweits@hotmail.com">ChengWei </a> 
 * 一个生成HTML的类
 */
public class WriteHtml {

    public WriteHtml() {
    }

    //文件保存
    public static void save(String templateContent, String pathName, String fileName)
            throws WriteFileException {
        try {
            checkFile(pathName);
            FileOutputStream fileoutputstream = new FileOutputStream(pathName + fileName);
            byte abyte0[] = templateContent.getBytes();
            fileoutputstream.write(abyte0);
            fileoutputstream.close();
        } catch (IOException ioexception) {
            throw new WriteFileException();
        }
    }
    //文件不存在,则创建目录以及文件
    private static void checkFile(String path) {
        File file = new File(path);
        if (!file.exists())
            file.mkdirs();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -