Java2HTML改造手记(5)(转)
Java2HTML改造手记(5)
XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" />
你所需要的网站建设服务,我们均能行业靠前的水平为你提供.标准是产品质量的保证,主要从事网站设计制作、成都做网站、企业网站建设、移动网站建设、网页设计、品牌网站制作、网页制作、做网站、建网站。成都创新互联公司拥有实力坚强的技术研发团队及素养的视觉设计专才。
接下来就是我们的重头戏了.让这个参数起作用.
在java2html.java main方法中最后调用了
java2html.buildJava2HTML();
那么我们就从这里继续吧.
public boolean buildJava2HTML()
throws Exception
{
O01049();
O01050 o01050 = new O01050(O01044);
if(O01043 == null)
{
setJavaDirectorysource(new String[] {
"."
});
}
O01052 o01052 = new O01052(O01043, O01045, O01040, O01041, O01012, O01014, o01050);
if(!O01042)
{
O01052.O01054(O01045, o01052, O01002);
}
o01052.O01055();
return true;
}
先看看O01049()作了什么:
private void O01049()
throws IOException
{
(new File(O01045)).mkdirs();
File file = null;
FileWriter filewriter = null;
file = new File(O01045 + File.separator + "stylesheet.css");
filewriter = new FileWriter(file);
filewriter.write(O07.O0998());
filewriter.close();
System.out.println("Created " + file.getAbsolutePath());
if(!O01042)
{
File file1 = new File(O01045 + File.separator + "front.html");
FileWriter filewriter1 = new FileWriter(file1);
filewriter1.write(O07.O0999());
filewriter1.close();
System.out.println("Created " + file1.getAbsolutePath());
file1 = new File(O01045 + File.separator + "index.html");
filewriter1 = new FileWriter(file1);
filewriter1.write(O07.O01001(O01002));
filewriter1.close();
}
}
原来这里生成了几个基本的页面和样式表.而所需的资源是从O07中读取出来的,看来这个文件是重点了.不过这个方法也要修改一下,在输出html文件的时候应该使用用户指定的属性,既然资源是从O07出来的,那么给O07也添加一个encoding属性吧.
//O07.java
static String s2;
public static void setEncoding(String str){
s2=str;
}
//java2html.java
private void O01049()
throws IOException
{
(new File(O01045)).mkdirs();
File file = null;
FileWriter filewriter = null;
file = new File(O01045 + File.separator + "stylesheet.css");
filewriter = new FileWriter(file);
//modify
filewriter.write(new String(O07.O0998().getBytes(encoding)));
filewriter.close();
System.out.println("Created " + file.getAbsolutePath());
if(!O01042)
{
//写了front.html文件,资源是从O07读取的.原来O07是一个资源文件
//那么我们也给O07添加一个Encoding属性吧.
O07.setEncoding(encoding);
File file1 = new File(O01045 + File.separator + "front.html");
FileWriter filewriter1 = new FileWriter(file1);
//编码处理
filewriter1.write(new String(O07.O0999().getBytes(encoding)));
filewriter1.close();
System.out.println("Created " + file1.getAbsolutePath());
file1 = new File(O01045 + File.separator + "index.html");
filewriter1 = new FileWriter(file1);
//编码处理
filewriter1.write(new String((O07.O01001(O01002)).getBytes(encoding)));
filewriter1.close();
}
}
让我们回到buildjava2html方法中,看到:
O01052 o01052 = new O01052(O01043, O01045, O01040, O01041, O01012, O01014, o01050);
原来用户参数都是在这里传送进去的,那么把我们的参数也送进取吧.
O01052 o01052 = new O01052(O01043, O01045, O01040, O01041, O01012, O01014, o01050,encoding);
然后在O01052中添加:
private static String encoding;
并把它的构造函数修改一下:
public O01052(String as[], String s, int i, int j, boolean flag, boolean flag1, O01050 o01050,String s1)
{
O0106 = new O040(System.in);
for(int k = 0; k < as.length; k++)
{
O01097(as[k]);
}
O01045 = s;
O01040 = i;
O01041 = j;
O01012 = flag;
O01014 = flag1;
O01051 = o01050;
encoding=s1;
}
本文标题:Java2HTML改造手记(5)(转)
本文地址:http://myzitong.com/article/gsscpo.html