⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b.java

📁 // pica客户端J2ME源码
💻 JAVA
字号:
// pica客户端J2ME源码,100%可运行可修改,J2ME逆向工程经典作品
// 作者:fangji999
// QQ:57979471 Email:fangji999@163.com
// 博客:http://hi.baidu.com/ccall_net
// QQ群:51719370
// 如用此源码重新改写的软件或转载,请保留本人联系方式,作品原创作者

package utils;

import java.io.*;
import java.util.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.Font;
import pica.*;
//网络连接处理类和公用函数类
public final class b
{

	public static int a;

	public b()
	{
	}

	public static String a(Date date)
	{
		Calendar calendar;
		(calendar = Calendar.getInstance()).setTime(date);
		StringBuffer stringbuffer;
		(stringbuffer = new StringBuffer()).append(Integer.toString(calendar.get(1)));
		stringbuffer.append("/");
		a(stringbuffer, calendar.get(2) + 1, "/");
		a(stringbuffer, calendar.get(5), " ");
		a(stringbuffer, calendar.get(11), ":");
		a(stringbuffer, calendar.get(12), "");
		return stringbuffer.toString();
	}

	public static Date a(String s)
	{
		Date date = null;
		try
		{
			Calendar calendar;
			(calendar = Calendar.getInstance()).set(1, Integer.parseInt(s.substring(0, 4)));
			calendar.set(2, Integer.parseInt(s.substring(4, 6)) - 1);
			calendar.set(5, Integer.parseInt(s.substring(6, 8)));
			calendar.set(11, Integer.parseInt(s.substring(9, 11)));
			calendar.set(12, Integer.parseInt(s.substring(12, 14)));
			calendar.set(13, Integer.parseInt(s.substring(15, 16)));
			calendar.set(14, 0);
			date = calendar.getTime();
		}
		catch (Exception  e)
		{
			date = new Date();
		}
		return date;
	}

	private static void a(StringBuffer stringbuffer, int i, String s)
	{
		int j = stringbuffer.length();
		stringbuffer.append(Integer.toString(i));
		if (stringbuffer.length() - j == 1)
			stringbuffer.insert(stringbuffer.length() - 1, "0");
		stringbuffer.append(s);
	}

	public static String a(String s, String s1, String s2)
		throws IOException, Exception
	{
		ByteArrayOutputStream bytearrayoutputstream;
		DataOutputStream dataoutputstream;
		DataInputStream datainputstream;
		bytearrayoutputstream = null;
		dataoutputstream = null;
		datainputstream = null;
		bytearrayoutputstream = new ByteArrayOutputStream();
		dataoutputstream = new DataOutputStream(bytearrayoutputstream);
		String s4=null;
		byte abyte0[] = null;
		if (s2 != null && !s2.equals(""))
		{
			dataoutputstream.writeUTF(s2);
			abyte0 = bytearrayoutputstream.toByteArray();
		}
                System.out.println("s:"+s+"s1:"+s1+"s2:"+s2);
		datainputstream = a(s, s1, abyte0, false, w.h == 0);
		int i = 0;
		byte abyte1[] = null;
		if (a > 0)
		{
			abyte1 = new byte[a];
			datainputstream.readFully(abyte1);
		} else
		{
			int j = 1024;
			abyte1 = new byte[1024];
			do
			{
				int l;
				if ((l = datainputstream.read()) == -1)
					break;
				abyte1[i] = (byte)l;
				if (++i == j)
				{
					byte abyte2[] = new byte[j += 1024];
					System.arraycopy(abyte1, 0, abyte2, 0, i);
					abyte1 = abyte2;
				}
			} while (true);
		}
		//String s3;
		s4 = new String(abyte1, 0, a <= 0 ? i : a, "UTF-8");
		if (datainputstream != null)
			try
			{
				datainputstream.close();
			}
			catch (Exception  e) { }
		try
		{
			bytearrayoutputstream.close();
		}
		catch (Exception  e) { }
		try
		{
			dataoutputstream.close();
		}
		catch (Exception  e) { }
		return s4;
//		IOException ioexception;
//		ioexception;
//		throw new IOException(ioexception.toString());
//		JVM INSTR dup ;
//		Exception exception;
//		exception;
//		getMessage();
//		"error:404";
//		equals();
//		JVM INSTR ifeq 274;
//		   goto _L1 _L2
//_L1:
//		break MISSING_BLOCK_LABEL_271;
//_L2:
//		break MISSING_BLOCK_LABEL_274;
//		throw exception;
//		exception.printStackTrace();
//		if (datainputstream != null)
//			try
//			{
//				datainputstream.close();
//			}
//			catch (Exception  e) { }
//		try
//		{
//			bytearrayoutputstream.close();
//		}
//		catch (Exception  e) { }
//		try
//		{
//			dataoutputstream.close();
//		}
//		catch (Exception  e) { }
////		break MISSING_BLOCK_LABEL_349;
////		Exception exception1;
////		exception1;
//		if (datainputstream != null)
//			try
//			{
//				datainputstream.close();
//			}
//			catch (Exception  e) { }
//		try
//		{
//			bytearrayoutputstream.close();
//		}
//		catch (Exception  e) { }
//		try
//		{
//			dataoutputstream.close();
//		}
//		catch (Exception  e) { }
////		throw exception1;
//		return null;
	}

	public static void a(String s, String s1, ByteArrayOutputStream bytearrayoutputstream)
	{
		DataInputStream datainputstream;
		datainputstream = null;
		Pica.n.h = true;
		Pica.l.a(Pica.n);
                try {
                     datainputstream = a(s, s1, bytearrayoutputstream.toByteArray(), true, w.h == 0);

                        Pica.n.e();
                        Pica.o.a(datainputstream);

               } catch (Exception ex) {
                    ex.printStackTrace();
                }             
		if (datainputstream != null){
			try
			{
				datainputstream.close();
			}
			catch (Exception  e) { }
                       return;
    //		JVM INSTR dup ;
    //		Exception exception;
    //		exception;
    //		printStackTrace();

                }
                    Pica.n.e();
                    Pica.n.h = false;
                    Pica.n.a(new k("无法显示页面!请尝试后退或返回首页!", null, (byte)1));
                    Pica.n.a();
                    Pica.l.a(Pica.n);
		return;

	}

	private static DataInputStream a(String s, String s1, byte abyte0[], boolean flag, boolean flag1)
		throws Exception
	{
		HttpConnection httpconnection;
		DataOutputStream dataoutputstream;
		httpconnection = null;
		dataoutputstream = null;
		Object obj = null;
		if (flag1)
			s1 = "http://10.0.0.172:80" + s1;
		else
			s1 = "http://" + s + s1;
                
		(httpconnection = (HttpConnection)Connector.open(s1, 3, true)).setRequestMethod(abyte0 == null ? "GET" : "POST");
		httpconnection.setRequestProperty("X-Online-Host", s);
		if (abyte0 != null)
			if (flag)
				httpconnection.setRequestProperty("Content-Type", "application/octet-stream");
			else
				httpconnection.setRequestProperty("Content-Type", "text/xml");
		httpconnection.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
		if (flag)
		{
			if (Pica.o.f)
				httpconnection.setRequestProperty("Pica-Auth", w.ls + "/" + w.m);
			else
				httpconnection.setRequestProperty("Pica-Session", Pica.o.g);
		} else
		if (abyte0 != null)
			httpconnection.setRequestProperty("Content-Length", "" + abyte0.length);
		if (abyte0 != null)
		{
			dataoutputstream = httpconnection.openDataOutputStream();
			if (flag)
				dataoutputstream.write(abyte0);
			else
				dataoutputstream.write(abyte0, 2, abyte0.length - 2);
		}
		Object obj1;
		if (httpconnection.getResponseCode() != 200)
		{
			if (httpconnection.getResponseCode() == 480)
				Pica.o.f = true;
			else
			if (httpconnection.getResponseCode() == 404)
				throw new Exception("error:404");
			throw new Exception("invalid response");
		}
		a = httpconnection.getHeaderFieldInt("Content-Length", 0);
		if (flag && Pica.o.f)
		{
			Pica.o.g = httpconnection.getHeaderField("pica-session");
			if (Pica.o.g != null)
				Pica.o.f = false;
		}
		DataInputStream datainputstream;
		obj1 = datainputstream = httpconnection.openDataInputStream();
		if (dataoutputstream != null)
			try
			{
				dataoutputstream.close();
			}
			catch (Exception  e) { }
		if (httpconnection != null)
			try
			{
				httpconnection.close();
			}
			catch (Exception  e) { }
		if (w.h == 0)
			throw new IOException("error=网络连接失败,请尝试取消“使用代理服务器”选项!");		
                return ((DataInputStream) (obj1));
//		JVM INSTR pop ;
//		if (w.h == 0)
//			throw new IOException("error=网络连接失败,请尝试取消“使用代理服务器”选项!");
 //		else
//			throw new IOException("error=网络连接失败,请尝试选择“使用代理服务器”选项!");
//		JVM INSTR dup ;
//		obj1;
//		getMessage();
//		"error:404";
//		equals();
//		JVM INSTR ifeq 498;
//		   goto _L1 _L2
//_L1:
//		break MISSING_BLOCK_LABEL_495;
//_L2:
//		break MISSING_BLOCK_LABEL_498;
//		throw obj1;
//		if (dataoutputstream != null)
//			try
//			{
//				dataoutputstream.close();
//			}
//			catch (Exception  e) { }
//		if (httpconnection != null)
//			try
//			{
//				httpconnection.close();
//			}
//			catch (Exception  e) { }
//		return null;
//		Exception exception;
//		exception;
//		if (dataoutputstream != null)
//			try
//			{
//				dataoutputstream.close();
//			}
//			catch (Exception  e) { }
//		if (httpconnection != null)
//			try
//			{
//				httpconnection.close();
//			}
//			catch (Exception  e) { }
//		throw exception;
	}

	public static String b(String s)
	{
		StringBuffer stringbuffer = new StringBuffer();
		for (int i = 0; i < s.length(); i++)
		{
			char c;
			switch (c = s.charAt(i))
			{
			case 60: // '<'
				stringbuffer.append("&lt;");
				break;

			case 62: // '>'
				stringbuffer.append("&gt;");
				break;

			case 38: // '&'
				stringbuffer.append("&amp;");
				break;

			case 39: // '\''
				stringbuffer.append("&apos;");
				break;

			case 34: // '"'
				stringbuffer.append("&quot;");
				break;

			default:
				stringbuffer.append(c);
				break;
			}
		}

		if (stringbuffer.length() > 0)
			return stringbuffer.toString();
		else
			return "";
	}

	public static String[] a(String s, char c)
	{
		if (s == null || s.length() == 0)
			return new String[0];
		Vector vector = new Vector();
		StringBuffer stringbuffer = new StringBuffer();
		int i = s.length();
		for (int j = 0; j < i; j++)
		{
			char c1;
			if ((c1 = s.charAt(j)) == c)
			{
				String s2;
				if ((s2 = stringbuffer.toString().trim()).length() > 0)
					vector.addElement(s2);
				stringbuffer.setLength(0);
			} else
			{
				stringbuffer.append(c1);
			}
		}

		if (stringbuffer.length() > 0)
		{
			String s1;
			if ((s1 = stringbuffer.toString().trim()).length() > 0)
				vector.addElement(s1);
			stringbuffer.setLength(0);
		}
		String as[] = new String[vector.size()];
		for (int l = 0; l < as.length; l++)
			as[l] = (String)vector.elementAt(l);

		return as;
	}

	static 
	{
		Font.getFont(0, 0, 8);
		Font.getFont(0, 0, 16);
		Font.getFont(0, 0, 0);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -