本文整理汇总了Java中java.rmi.server.RemoteRef.readExternal方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteRef.readExternal方法的具体用法?Java RemoteRef.readExternal怎么用?Java RemoteRef.readExternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.server.RemoteRef
的用法示例。
在下文中一共展示了RemoteRef.readExternal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readExternal
import java.rmi.server.RemoteRef; //导入方法依赖的package包/类
/**
* To obtain the description of the Serialization of this class see the Serialized form of
* java.rmi.server.RemoteObject.
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
id = (ActivationID) in.readObject();
String s = in.readUTF();
if (s.equals("")) { //$NON-NLS-1$
return;
}
Class extRefTypeClass = Class.forName(RemoteRef.packagePrefix +"."+ s); //$NON-NLS-1$
try {
ref = (RemoteRef)extRefTypeClass.newInstance();
}
catch(Throwable t) {
// rmi.73=Instantiation failed.
throw new ClassNotFoundException(Messages.getString("rmi.73"), t); //$NON-NLS-1$
}
ref.readExternal(in);
}
示例2: readObject
import java.rmi.server.RemoteRef; //导入方法依赖的package包/类
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
// rmi.log.06=ActivationID.readObject:
rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.06")); //$NON-NLS-1$
try {
uid = (UID) in.readObject();
// rmi.log.07=UID={0}
rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.07", uid)); //$NON-NLS-1$
String refType = in.readUTF();
// rmi.log.08=refType={0}
rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.08", refType)); //$NON-NLS-1$
Class<?> cl = Class.forName("org.apache.harmony.rmi.remoteref." //$NON-NLS-1$
+ refType);
RemoteRef ref = (RemoteRef) cl.newInstance();
// rmi.log.09=ref = {0}
rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.09", ref)); //$NON-NLS-1$
ref.readExternal(in);
// rmi.log.0A=readExternal finished successfully.
rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.0A")); //$NON-NLS-1$
Class<?> activator_class = RMIClassLoader.loadClass((String) null,
"org.apache.harmony.rmi.activation.Rmid_Stub"); //$NON-NLS-1$
Class[] constructor_parameter_classes = { RemoteRef.class };
Constructor<?> constructor = activator_class
.getConstructor(constructor_parameter_classes);
Object[] constructor_parameters = { ref };
activator = (Activator) constructor.newInstance(constructor_parameters);
// rmi.log.0B=ActivationID.readObject COMPLETED.
rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.0B")); //$NON-NLS-1$
} catch (Throwable t) {
// rmi.09=Unable to deserialize ActivationID: {0}
throw new IOException(Messages.getString("rmi.09", t)); //$NON-NLS-1$
}
}