📄 readtemplate.java
字号:
package net.ijsp.news.news;
/**
* Title 读取模板配置信息
* @author: ccjsmile
* Company: http://www.ijsp.net
* Copyright: Copyright (c) 2003
* @version 1.0 beta
*/
import java.io.FileInputStream;
import java.io.IOException;
public class ReadTemplate {
private static String templateContent = null; // 模板内容
// private static String fileName = null; // 模板文件名
private static Object lock = new Object();
// private String pathFile = "";
/**
* 获取模板基本配置信息
* @return String
* @throws ReadTemplateException
*/
public static String getTlpContent() throws ReadTemplateException {
/*
if(templateContent==null) {
synchronized(lock) {
if(templateContent==null)
try{
System.out.println("+++++++++++++");
templateContent = readTemplate(pathFile);
}catch(ReadTemplateException r) {
throw new ReadTemplateException("模板信息读取失败。");
}
}
}
*/
return templateContent;
}
/**
* 读取文件内容
* @return String
* @throws ReadTemplateException
*/
private synchronized static String readTemplate(String pathFile) throws ReadTemplateException {
String templateContent = null;
/**
try{
FileInputStream fis = new FileInputStream(pathFile);
int fileLength = fis.available();
byte template[] = new byte[fileLength];
fis.read(template);
fis.close();
templateContent = new String(template);
}catch(IOException ie){
throw new ReadTemplateException();
}
*/
return templateContent;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -