分享
 
 
 

Java2HTML改造手记(3)

王朝java/jsp·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

Ja Java2HTML改造手记(3)

先重点看这个:

public static void main(String args[])

{

……………….

java2html = new Java2HTML();

o01 = new O01(args);

……………….

}

参数又跳转到o01上了.那么我们继续,没办法,逆向工程是需要耐心的.

// Source File Name: O01.java

package com.java2html;

import java.io.File;

import java.io.PrintStream;

import java.util.Vector;

// Referenced classes of package com.java2html:

// BadOptionException, Java2HTML, JavaDoc, O07

public class O01

{

private String O02[];

private boolean O03[];

O01(String as[])

{

O02 = as;

O03 = new boolean[as.length];

}

boolean O04(Java2HTML java2html)

throws BadOptionException

{

if(O02.length == 0 || O06(new String[] {

"help", "h", "?", "/?"

}))

{

System.out.println(O07.O08);

return false;

}

String as[] = O010(new String[] {

"name", "n"

}, false, 1);

if(as.length == 1)

{

java2html.setTitle(as[0]);

}

java2html.setFooter(O06(new String[] {

"nofooter", "nf"

}));

java2html.setFooter(O06(new String[] {

"noheader", "nh"

}));

java2html.setSimple(O06(new String[] {

"simple", "s"

}));

int ai[] = O012(new String[] {

"margin", "m"

}, false, 1);

if(ai.length == 1)

{

java2html.setMarginSize(ai[0]);

}

int ai1[] = O012(new String[] {

"tabs", "t"

}, false, 1);

if(ai1.length == 1)

{

java2html.setTabSize(ai1[0]);

}

String as1[] = O010(new String[] {

"destination", "d"

}, false, 1);

if(as1.length == 1)

{

java2html.setDestination(as1[0]);

}

String as2[] = O010(new String[] {

"javasource", "js"

}, false, -1);

if(as2.length > 0)

{

java2html.setJavaDirectorySource(as2);

}

JavaDoc ajavadoc[] = O017(new String[] {

"javadoc", "jd"

});

if(ajavadoc.length > 0)

{

java2html.setJavaDoc(ajavadoc);

}

O018();

return true;

}

private boolean O06(String as[])

throws BadOptionException

{

int i = 0;

int j = 0;

boolean flag = false;

for(; i < O02.length; i++)

{

for(int k = 0; k < as.length; k++)

{

if(!O02[i].equalsIgnoreCase("-" + as[k]))

{

continue;

}

O03[i] = true;

if(j >= 1)

{

throw new BadOptionException(as[0] + " should only be set once");

}

j++;

flag = true;

break;

}

}

return flag;

}

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

}

}

private int[] O012(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");

}

int ai[] = null;

try

{

ai = O028(vector);

}

catch(Exception _ex)

{

throw new BadOptionException(as[0] + " must be a number");

}

return ai;

}

public JavaDoc[] O017(String as[])

throws BadOptionException

{

int i = 0;

int j = 0;

Vector vector = new Vector();

for(; i < O02.length; i++)

{

for(int k = 0; k < as.length; k++)

{

if(!O02[i].equalsIgnoreCase("-" + as[k]))

{

continue;

}

O03[i] = true;

if(++i >= O02.length)

{

throw new BadOptionException("Value not set for " + as[0]);

}

O03[i] = true;

JavaDoc javadoc = null;

File file = new File(O02[i]);

String s = null;

if(i + 1 < O02.length && !O02[i + 1].startsWith("-"))

{

i++;

if(!O02[i].startsWith("http://"))

{

throw new BadOptionException("Second Parameter of -jd/-javadoc option must start with 'http://'");

}

s = O02[i];

O03[i] = true;

}

if(s != null)

{

javadoc = new JavaDoc(file, s);

} else

{

javadoc = new JavaDoc(file);

}

vector.addElement(javadoc);

j++;

break;

}

}

JavaDoc ajavadoc[] = new JavaDoc[vector.size()];

for(int l = 0; l < vector.size(); l++)

{

ajavadoc[l] = (JavaDoc)vector.elementAt(l);

}

return ajavadoc;

}

private String[] O026(Vector vector)

{

String as[] = new String[vector.size()];

for(int i = 0; i < vector.size(); i++)

{

as[i] = (String)vector.elementAt(i);

}

return as;

}

private int[] O028(Vector vector)

{

int ai[] = new int[vector.size()];

for(int i = 0; i < vector.size(); i++)

{

ai[i] = Integer.parseInt((String)vector.elementAt(i));

}

return ai;

}

public void O018()

throws BadOptionException

{

for(int i = 0; i < O03.length; i++)

{

if(!O03[i])

{

throw new BadOptionException("Unkown Argument :" + O02[i]);

}

}

}

}

找到这里:

O01(String as[])

{

O02 = as;

O03 = new boolean[as.length];

}

看来这里没有作什么,那么我们回到java2html.java文件继续往下看:

public static void main(String args[])

{

…………………..

java2html = new Java2HTML();

o01 = new O01(args);

//这里就是了

if(!o01.O04(java2html))

{

return;

}

………………….

}

原来调用了o01.O04方法.看看:

boolean O04(Java2HTML java2html)

throws BadOptionException

{

if(O02.length == 0 || O06(new String[] {

"help", "h", "?", "/?"

}))

{

System.out.println(O07.O08);

return false;

}

String as[] = O010(new String[] {

"name", "n"

}, false, 1);

if(as.length == 1)

{

java2html.setTitle(as[0]);

}

java2html.setFooter(O06(new String[] {

"nofooter", "nf"

}));

java2html.setFooter(O06(new String[] {

"noheader", "nh"

}));

java2html.setSimple(O06(new String[] {

"simple", "s"

}));

int ai[] = O012(new String[] {

"margin", "m"

}, false, 1);

if(ai.length == 1)

{

java2html.setMarginSize(ai[0]);

}

int ai1[] = O012(new String[] {

"tabs", "t"

}, false, 1);

if(ai1.length == 1)

{

java2html.setTabSize(ai1[0]);

}

String as1[] = O010(new String[] {

"destination", "d"

}, false, 1);

if(as1.length == 1)

{

java2html.setDestination(as1[0]);

}

String as2[] = O010(new String[] {

"javasource", "js"

}, false, -1);

if(as2.length > 0)

{

java2html.setJavaDirectorySource(as2);

}

JavaDoc ajavadoc[] = O017(new String[] {

"javadoc", "jd"

});

if(ajavadoc.length > 0)

{

java2html.setJavaDoc(ajavadoc);

}

O018();

return true;

}

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有