当前位置: 技术问答>java相关
有一个菜鸟问题,再线等待,答完给分,谢谢!
来源: 互联网 发布时间:2017-04-10
本文导语: 下面这句话怎么理解?init()是干什么的? ErrorFlag = init() ^ true; 我把所有代码贴出来: package Html; import java.io.*; import java.util.*; // Referenced classes of package Html: // Config, HtmlTemplateBody class HtmlT...
下面这句话怎么理解?init()是干什么的?
ErrorFlag = init() ^ true;
我把所有代码贴出来:
package Html;
import java.io.*;
import java.util.*;
// Referenced classes of package Html:
// Config, HtmlTemplateBody
class HtmlTemplate
{
public HtmlTemplate()
{
instance = this;
config = new Config();
templib = new Hashtable();
out = null;
ErrorFlag = init() ^ true;
}
public void Destroy()
{
if(config.Debug)
{
instance = null;
out.close();
}
}
public static HtmlTemplate getInstance()
{
if(instance == null)
instance = new HtmlTemplate();
if(instance.config.Debug)
{
HtmlTemplate htmltemplate = instance;
instance = null;
return htmltemplate;
}
else
{
return instance;
}
}
public HtmlTemplateBody getTemp(String s)
{
if(!templib.containsKey(s) && !loadTemp(s))
{
return null;
}
else
{
HtmlTemplateBody htmltemplatebody = (HtmlTemplateBody)templib.get(s);
return htmltemplatebody;
}
}
public boolean init()
{
java.io.InputStream inputstream = getClass().getResourceAsStream("htmltemplate.conf");
Properties properties = new Properties();
try
{
properties.load(inputstream);
}
catch(Exception _ex)
{
outError("Cannot load htmltemplate.conf.");
return false;
}
config.TemplateDir = properties.getProperty("TemplateDir", "/template");
config.Debug = !properties.getProperty("Debug", "FALSE").equals("FALSE");
config.LogFile = properties.getProperty("LogFile", "/template/template.log");
config.TagName = "
ErrorFlag = init() ^ true;
我把所有代码贴出来:
package Html;
import java.io.*;
import java.util.*;
// Referenced classes of package Html:
// Config, HtmlTemplateBody
class HtmlTemplate
{
public HtmlTemplate()
{
instance = this;
config = new Config();
templib = new Hashtable();
out = null;
ErrorFlag = init() ^ true;
}
public void Destroy()
{
if(config.Debug)
{
instance = null;
out.close();
}
}
public static HtmlTemplate getInstance()
{
if(instance == null)
instance = new HtmlTemplate();
if(instance.config.Debug)
{
HtmlTemplate htmltemplate = instance;
instance = null;
return htmltemplate;
}
else
{
return instance;
}
}
public HtmlTemplateBody getTemp(String s)
{
if(!templib.containsKey(s) && !loadTemp(s))
{
return null;
}
else
{
HtmlTemplateBody htmltemplatebody = (HtmlTemplateBody)templib.get(s);
return htmltemplatebody;
}
}
public boolean init()
{
java.io.InputStream inputstream = getClass().getResourceAsStream("htmltemplate.conf");
Properties properties = new Properties();
try
{
properties.load(inputstream);
}
catch(Exception _ex)
{
outError("Cannot load htmltemplate.conf.");
return false;
}
config.TemplateDir = properties.getProperty("TemplateDir", "/template");
config.Debug = !properties.getProperty("Debug", "FALSE").equals("FALSE");
config.LogFile = properties.getProperty("LogFile", "/template/template.log");
config.TagName = "