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

📄 xmlrpcclient.java

📁 Mofire的JAR压缩包
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   XmlRpcClient.java

package org.kxmlrpc;

import java.io.*;
import java.util.Vector;
import javax.microedition.io.*;
import org.kxml.io.XmlWriter;
import org.kxml.parser.XmlParser;

// Referenced classes of package org.kxmlrpc:
//			XmlRpcWriter, XmlRpcParser

public class XmlRpcClient
{

	String url;
	Object result;
	boolean debug;

	public XmlRpcClient(String url)
	{
		result = null;
		debug = true;
		this.url = url;
	}

	public XmlRpcClient(String hostname, int port)
	{
		result = null;
		debug = true;
		url = "http://" + hostname + ":" + port;
	}

	public String getURL()
	{
		return url;
	}

	public void setURL(String newUrl)
	{
		url = newUrl;
	}

	public Object execute(String method, Vector params)
		throws Exception
	{
		HttpConnection con;
		InputStream in;
		OutputStream out;
		XmlWriter xw = null;
		XmlRpcWriter writer = null;
		XmlRpcParser parser = null;
		con = null;
		in = null;
		out = null;
		ByteArrayOutputStream bos = null;
		try
		{
			ByteArrayOutputStream bos = new ByteArrayOutputStream();
			XmlWriter xw = new XmlWriter(new OutputStreamWriter(bos, "UTF-8"));
			XmlRpcWriter writer = new XmlRpcWriter(xw);
			writer.writeCall(method, params);
			xw.flush();
			if (debug)
				System.out.println(bos.toString());
			byte request[] = bos.toByteArray();
			int messageLength = request.length;
			con = (HttpConnection)Connector.open(url, 3);
			con.setRequestMethod("POST");
			con.setRequestProperty("Content-Length", Integer.toString(messageLength));
			con.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
			out = con.openOutputStream();
			out.write(request);
			in = con.openInputStream();
			XmlRpcParser parser = new XmlRpcParser(new XmlParser(new InputStreamReader(in)));
			result = parser.parseResponse();
		}
		catch (Exception x)
		{
			x.printStackTrace();
			throw (Exception)result;
		}
		break MISSING_BLOCK_LABEL_270;
		Exception exception;
		exception;
		try
		{
			if (con != null)
				con.close();
			if (in != null)
				in.close();
			if (out != null)
				out.close();
		}
		catch (IOException ioe)
		{
			ioe.printStackTrace();
		}
		throw exception;
		try
		{
			if (con != null)
				con.close();
			if (in != null)
				in.close();
			if (out != null)
				out.close();
		}
		catch (IOException ioe)
		{
			ioe.printStackTrace();
		}
		if (result instanceof Exception)
			throw (Exception)result;
		else
			return result;
	}

	void setParsedObject(Object parsedObject)
	{
		result = parsedObject;
	}
}

⌨️ 快捷键说明

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