jsp生成html--readtemplates

来源: LUPA开源社区
发布时间: 2007-05-27 03:50 版权申明

字体:


文章来源于http://www.lupaworld.com


package ball.news;
import java.io.*;
import java.util.*;

public class ReadTemplates
{

private String temp = null;
private Object a = new Object();

public ReadTemplates()
{
}

public String getTlpContent(String s)

{
if(temp == null)
synchronized(a)
{
if(temp == null)
try
{
System.out.println("----------------------------");
temp = a(s);
//System.out.println("test the temp"+temp);
}
catch(Exception e)
{
System.out.println("get tlpconente error"+e.getMessage());
}
}
return temp;
}

private synchronized String a(String s)

{
String s1 = null;
try
{
FileInputStream fileinputstream = new FileInputStream(s);
int i = fileinputstream.available();
byte abyte0[] = new byte[i];
fileinputstream.read(abyte0);
fileinputstream.close();
s1 = new String(abyte0);
}
catch(IOException e)
{
System.out.println("ioexception error"+e.getMessage());
}
return s1;
}

}


文章来源于http://www.lupaworld.com

声明:LUPA开源社区刊登此文只为传递信息,并不表示赞同或者反对。

查看全部评论(0)我来说两句 直接向LUPA提出您的宝贵建议

-5 -3 -1 - +1 +3 +5