您好,登錄后才能下訂單哦!
XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" />
原來這是一個判斷當前參數的方法:
if(O02.length == 0 || O06(new String[] {
"help", "h", "?", "/?"
}))
{
System.out.println(O07.O08);
return false;
}
這一段是幫助系統,既然我們要修改,那么先把幫助系統處理了.就當咱們肯定能把這個修改成功完成.
目標鎖定O07.O08(這是一個final static String):
public O07()
{
}
static
{
O0995 = System.getProperty("line.separator");
if(O0995 == null)
{
System.out.println("Warning:System Property line.separator not definedn");
O0995 = "rn";
}
O0997 = "Copyright (c) 2000-2003 Polygon Enterprises." + O0995 + "New Versions available from http://www.java2html.com" + O0995 + "(type j2h with no arguments to get help)";
O08 = O0995 + "Usage: [j2h|java j2h|java -jar j2h.jar][options]"
+ O0995 + "-d
+ O0995 + "-js
+ O0995 + "-jd
+ O0995 + "-m
+ O0995 + "-t
+ O0995 + "-n
+ O0995 + "-nh Prevents the header from being displayed"
+ O0995 + "-nf Prevents the footer from being displayed"
//我在這里添加了encoding的幫助信息
+ O0995 +"-encoding set the html "charset""
+O0995 + "-s Simple output, just include the Java source and stylesheet.CSS files"
+ O0995 + "-h (or no arguments) This Help" + O0995
+ O0995 + "Edit generated stylesheet.css file to change colours & styles"
+ O0995 + "View generated index.html in browser to see results after running"
+ O0995;
}
現在使用java2html的時候已經有了對encoding的幫助信息了.
String as2[] = O010(new String[] {"javasource", "js"}, false, -1);
幫助信息后我們看到了類似這樣的方法調用,看來這是判斷參數內容的方法了
private String[] O010(String as[], boolean flag, int i)
throws BadOptionException
{
int j = 0;
int k = 0;
Vector vector = new Vector();
for(; j < O02.length; j++)
{
for(int l = 0; l < as.length; l++)
{
if(!O02[j].equalsIgnoreCase("-" + as[l]))
{
continue;
}
O03[j] = true;
j++;
if(k == i)
{
throw new BadOptionException(as[0] + " should only be set " + i + " time(s)");
}
if(j >= O02.length)
{
throw new BadOptionException("Value not set for " + as[0]);
}
O03[j] = true;
vector.addElement(O02[j]);
k++;
break;
}
}
if(flag && k == 0)
{
throw new BadOptionException(as[0] + " needs to be set");
} else
{
return O026(vector);
}
}
原來這個方法是把用戶送進來的參數(as)和java2html默認的參數比較,如果是java2html的參數那么把用戶的參數取值.
我們先把咱們的參數添加上吧.
//添加我們自定義的參數
String as3[] = O010(new String[] {
"encoding", "encoding"
}, false, -1);
//同樣依葫蘆畫瓢
if(as3.length > 0)
{
java2html.setEncoding(as3[0]);
}
這樣用戶的參數就送進了as[]了.
不過現在java2html中并沒有setEncoding方法.我們的添加一個.
回到java2html.java中添加:
//我在這里設定了默認的字符編碼,因為utf-8基本上支持所有的字符編碼.
private String encoding="UTF-8";
//添加一個新方法
public void setEncoding(String strEncoding){
encoding=strEncoding;
}
這樣,用戶的參數就已經送到java2html類中了.
欲知后事如何,且聽下回分解.
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。