📄 ipcinterfaceimpl.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: IPCInterfaceImpl.java
package org.gudy.azureus2.pluginsimpl.local.ipc;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.gudy.azureus2.plugins.Plugin;
import org.gudy.azureus2.plugins.PluginInterface;
import org.gudy.azureus2.plugins.ipc.IPCException;
import org.gudy.azureus2.plugins.ipc.IPCInterface;
import org.gudy.azureus2.pluginsimpl.local.PluginInitializer;
public class IPCInterfaceImpl
implements IPCInterface
{
private Object target_use_accessor;
private String plugin_class;
private PluginInitializer plugin_initializer;
public IPCInterfaceImpl(PluginInitializer _plugin_initializer, Plugin _target)
{
plugin_initializer = _plugin_initializer;
target_use_accessor = _target;
plugin_class = _target.getClass().getName();
}
public IPCInterfaceImpl(Object _target)
{
target_use_accessor = _target;
plugin_class = _target.getClass().getName();
}
public boolean canInvoke(String methodName, Object params[])
{
Method mtd;
Object target = getTarget();
mtd = getMethod(target, methodName, params);
mtd.setAccessible(true);
if (mtd != null)
return true;
break MISSING_BLOCK_LABEL_31;
Throwable e;
e;
return false;
}
public Object invoke(String methodName, Object params[])
throws IPCException
{
Object target = getTarget();
Method mtd;
mtd = getMethod(target, methodName, params);
mtd.setAccessible(true);
return mtd.invoke(target, params);
Throwable e;
e;
if ((e instanceof InvocationTargetException) && e.getCause() != null)
e = e.getCause();
throw new IPCException(e);
}
protected Method getMethod(Object target, String methodName, Object params[])
throws Throwable
{
if (params == null)
params = new Object[0];
Class paramTypes[] = new Class[params.length];
for (int i = 0; i < params.length; i++)
{
if (params[i] instanceof Boolean)
{
paramTypes[i] = Boolean.TYPE;
continue;
}
if (params[i] instanceof Integer)
{
paramTypes[i] = Integer.TYPE;
continue;
}
if (params[i] instanceof Long)
{
paramTypes[i] = Long.TYPE;
continue;
}
if (params[i] instanceof Float)
{
paramTypes[i] = Float.TYPE;
continue;
}
if (params[i] instanceof Double)
{
paramTypes[i] = Double.TYPE;
continue;
}
if (params[i] instanceof Byte)
{
paramTypes[i] = Byte.TYPE;
continue;
}
if (params[i] instanceof Character)
{
paramTypes[i] = Character.TYPE;
continue;
}
if (params[i] instanceof Short)
paramTypes[i] = Short.TYPE;
else
paramTypes[i] = params[i].getClass();
}
Method mtd = null;
try
{
mtd = target.getClass().getMethod(methodName, paramTypes);
}
catch (NoSuchMethodException e)
{
Method methods[] = target.getClass().getMethods();
for (int i = 0; i < methods.length; i++)
{
Method method = methods[i];
Class method_params[] = method.getParameterTypes();
if (!method.getName().equals(methodName) || method_params.length != paramTypes.length)
continue;
boolean ok = true;
int j = 0;
do
{
if (j >= method_params.length)
break;
Class declared = method_params[j];
Class supplied = paramTypes[j];
if (!declared.isAssignableFrom(supplied))
{
ok = false;
break;
}
j++;
} while (true);
if (!ok)
continue;
mtd = method;
break;
}
if (mtd == null)
throw e;
}
return mtd;
}
protected Object getTarget()
throws IPCException
{
IPCInterfaceImpl ipcinterfaceimpl = this;
JVM INSTR monitorenter ;
if (target_use_accessor == null)
{
PluginInterface pis[] = plugin_initializer.getPlugins();
int i = 0;
do
{
if (i >= pis.length)
break;
PluginInterface pi = pis[i];
if (pi.getPlugin().getClass().getName().equals(plugin_class))
{
target_use_accessor = pi.getPlugin();
break;
}
i++;
} while (true);
}
if (target_use_accessor == null)
throw new IPCException("Plugin has been unloaded");
return target_use_accessor;
Exception exception;
exception;
throw exception;
}
public void unload()
{
synchronized (this)
{
target_use_accessor = null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -