📄 httpreader.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
package mmae.net;
import java.io.*;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import mmae.util.Tool;
// Referenced classes of package mmae.net:
// HttpListener
public class HttpReader extends Thread
{
public String content;
public String URL;
HttpListener c;
public static final int START = 0;
public static final int FINISH = 1;
public static final int READING = 2;
public static final int ERROR = 3;
public static final int SLEEP = 4;
public static final int CONNECTION_ERROR = 101;
private int d;
private boolean a;
private boolean b;
private int e;
public HttpReader()
{
e = 0;
}
public HttpReader(boolean flag)
{
e = 0;
a = flag;
}
public HttpReader(boolean flag, int i)
{
e = 0;
a = flag;
e = i;
}
public void open(String s)
{
try
{
URL = new String(s.getBytes("UTF-8"));
}
catch(Exception exception) { }
d = 0;
Thread thread = new Thread(this);
thread.start();
}
public boolean getSleep()
{
return b;
}
public void setValue(int i)
{
d = i;
}
public int getValue()
{
return d;
}
public void stop()
{
}
public String getString()
{
return content;
}
public void run()
{
try
{
content = read(URL);
dispatchEvent(1, 0);
}
catch(IOException ioexception)
{
System.out.println("http get Error:" + ioexception.getMessage());
}
}
public String read(String s)
throws IOException
{
HttpConnection httpconnection;
InputStream inputstream;
String s1;
httpconnection = null;
inputstream = null;
s1 = "";
dispatchEvent(0, 0);
d = 0;
httpconnection = (HttpConnection)Connector.open(s);
inputstream = httpconnection.openInputStream();
int i = (int)httpconnection.getLength();
byte abyte0[] = new byte[i];
int j = 0;
boolean flag = false;
if(i == 3760)
{
dispatchEvent(3, 101);
} else
{
int k;
while((k = inputstream.read()) != -1 && ++j < i)
{
if((j * 100) / i != d)
{
d = (j * 100) / i;
dispatchEvent(2, (j * 100) / i);
}
if(k == 0)
break;
if(k != 0)
abyte0[j] = (byte)k;
}
s1 = Tool.toUTF(abyte0, i);
d = 100;
dispatchEvent(2, d);
if(a)
{
b = true;
dispatchEvent(4, 0);
try
{
if(e == 0)
{
this;
sleep(1500L);
} else
{
this;
sleep(e);
}
}
catch(InterruptedException interruptedexception)
{
System.out.println("XCanvas Thread Error:" + interruptedexception.getMessage());
}
}
}
if(inputstream != null)
inputstream.close();
else
dispatchEvent(3, 101);
if(httpconnection != null)
httpconnection.close();
else
dispatchEvent(3, 101);
break MISSING_BLOCK_LABEL_425;
IOException ioexception;
ioexception;
System.out.println("err:" + ioexception.getMessage());
dispatchEvent(3, 101);
if(inputstream != null)
inputstream.close();
else
dispatchEvent(3, 101);
if(httpconnection != null)
httpconnection.close();
else
dispatchEvent(3, 101);
break MISSING_BLOCK_LABEL_425;
Exception exception;
exception;
if(inputstream != null)
inputstream.close();
else
dispatchEvent(3, 101);
if(httpconnection != null)
httpconnection.close();
else
dispatchEvent(3, 101);
throw exception;
return s1;
}
protected final void dispatchEvent(int i, int j)
{
if(c != null)
c.httpEvent(i, j);
}
public void setListener(HttpListener httplistener)
{
c = httplistener;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -