ITPub博客

首页 > 应用开发 > Java > Java2HTML改造手记(6) (转)

Java2HTML改造手记(6) (转)

原创 Java 作者:amyz 时间:2007-11-24 10:45:39 0 删除 编辑
Java2HTML改造手记(6) (转)[@more@]

Java2HTML改造手记(6)

XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" />

Buildjava2html方法最后调用了O01055方法,看来这个方法是最终生成html页面的方法了.

既然如此,那么我们就把这个方法中出现的所有write方法中的参数加上”.getBytes(encoding)”,而这个encoding在构造方法中已经用用户指定的编码赋值了.

修改过的是这样的:

  public void O01055()

  throws Exception

  {

  Hashtable hashtable = O01093();

  Enumeration enumeration = hashtable.keys();

  object obj = null;

  Object obj1 = null;

  while(enumeration.hasMoreElements())

  {

  String s = (String)enumeration.nextElement();

   O01090 o01090 = (O01090)hashtable.get(s);

  File file = new File(O01045);

  String s1 = file.getAbsolutePath();

  if(!s1.endsWith(File.separator))

  {

  s1 = s1 + File.separator;

  }

  String s2 = null;

  if(o01090.O01082.equals(""))

  {

  s2 = s1 + o01090.O01006 + ".java.html";

  } else

  {

  s2 = s1 + O07.O01015(o01090.O01082, File.separatorChar) + File.separatorChar + o01090.O01006 + ".java.html";

  }

  File file1 = new File(s1 + O07.O01015(o01090.O01082, '/'));

  file1.mkdirs();

  O01025 o01025 = new O01025(s2, O01040, O01041);

  FileReader filereader = new FileReader(s);

  o01025.O01032(false);

  String s3 = ".";

  if(o01090.O01082.length() == 0)

  {

  s3 = "";

  }

  O07.setEncoding(encoding);

  String s4 = O07.O01018(o01090.O01082);

 

  String s5 = O01117(s4);

 

  o01025.write(new String(O07.O01004(s5 + "stylesheet.css", o01090.O01082 + s3 + o01090.O01006).getBytes(encoding)));

 

  o01025.write(new String(O07.O01011(o01090.O01006, "", O01012).getBytes(encoding)));

  o01025.write(new String(o01025.O01037().getBytes(encoding)));

  o01025.O01032(true);

  boolean flag = false;

  try

  {

  O0106.O0108(filereader, o01025, s5, this, O01051);

  o01025.O01032(false);

  }

  catch(O0109 _ex)

  {

  flag = true;

  System.out.println("Parse Error, Non-Legal Java File. (2nd Parse - File has changed since first pars" +

"e)"

);

  }

  catch(IOException _ex)

  {

  flag = true;

  System.out.println("IO Error. (2nd Parse)");

  }

  finally

  {

  try

   {

  o01025.write(new String(O07.O01013(o01090.O01006, "", O01014).getBytes(encoding)));

  o01025.write(new String(O07.O01007().getBytes(encoding)));

  o01025.close();

  }

   catch(IOException _ex) { }

  try

  {

  filereader.close();

  }

  catch(IOException _ex) { }

  }

  if(!flag)

  {

  System.out.println("Created: " + s2);

  }

  }

  }

从这个方法中可以看出所有的资源都是从O07类中来得.

那么我们就在这个这个类中结束全部工作吧.

欲知后事如何,且听下回分解.


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10752019/viewspace-983742/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    3982
  • 访问量
    7898980