接下來就是我們的重頭..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Java2HTML改造手記(5) (轉(zhuǎn))

發(fā)布時(shí)間:2020-08-08 20:04:46 來源:ITPUB博客 閱讀:134 作者:amyz 欄目:編程語言
Java2HTML改造手記(5) (轉(zhuǎn))[@more@]

Java2HTML改造手記(5)

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

接下來就是我們的重頭戲了.讓這個(gè)參數(shù)起作用.

在java2html.java main方法中最后調(diào)用了

java2html.buildJava2HTML();

那么我們就從這里繼續(xù)吧.

  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();

  }

  }

原來這里生成了幾個(gè)基本的頁面和樣式表.而所需的資源是從O07中讀取出來的,看來這個(gè)文件是重點(diǎn)了.不過這個(gè)方法也要修改一下,在輸出html文件的時(shí)候應(yīng)該使用用戶指定的屬性,既然資源是從O07出來的,那么給O07也添加一個(gè)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是一個(gè)資源文件

//那么我們也給O07添加一個(gè)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);

原來用戶參數(shù)都是在這里傳送進(jìn)去的,那么把我們的參數(shù)也送進(jìn)取吧.

O01052 o01052 = new O01052(O01043, O01045, O01040, O01041, O01012, O01014, o01050,encoding);

然后在O01052中添加:

private static String encoding;

并把它的構(gòu)造函數(shù)修改一下:

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;

  }

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


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI