jsp生成html--readtemplates

80酷酷网    80kuku.com

  js|生成htmlReadTemplates.java

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;
}

}




分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: