本文整理汇总了Java中java.rmi.server.UID.toString方法的典型用法代码示例。如果您正苦于以下问题:Java UID.toString方法的具体用法?Java UID.toString怎么用?Java UID.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.server.UID
的用法示例。
在下文中一共展示了UID.toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testToString005
import java.rmi.server.UID; //导入方法依赖的package包/类
public final void testToString005() {
uid = new UID();
StringTokenizer st = new StringTokenizer(uid.toString(), ":");
String s[] = new String[5];
for (int i = 0; i < 3; i++) {
s[i] = st.nextToken(":");
}
UID uid2 = new UID();
StringTokenizer st2 = new StringTokenizer(uid2.toString(), ":");
String s2[] = new String[5];
for (int i = 0; i < 3; i++) {
s2[i] = st2.nextToken(":");
}
for (int i = 0; i < 2; i++) {
assertEquals(s[i], s2[i]);
}
assertNotSame(s[2], s2[2]);
}
示例2: setId
import java.rmi.server.UID; //导入方法依赖的package包/类
/**
* Sets the id attribute of the Role object
*/
public void setId()
{
// generate a unique id that will be used as the rDn for this entry:
UID iid = new UID();
// assign the unique id to the internal id of the entity:
this.id = iid.toString();
}
示例3: createTempDir
import java.rmi.server.UID; //导入方法依赖的package包/类
/**
* Creates a folder in "java.io.tmpdir" with a unique name.
*/
public static File createTempDir() throws IOException {
UID uid = new UID();
File dir = new File(System.getProperty("java.io.tmpdir"));
File tmp = new File(dir, uid.toString());
if (!tmp.mkdirs()) {
throw new IOException("Cannot create tmp dir [" + tmp.toString() + "]");
}
return tmp;
}
示例4: createSimpleUUID
import java.rmi.server.UID; //导入方法依赖的package包/类
/**
* Creates a Universally Unique Identifier, via the java.rmi.server.UID class.
*/
public static String createSimpleUUID() {
UID uid = new UID();
String uidString=asHex(getIPAddress())+"-"+uid.toString();
// Replace semi colons by underscores, so IBIS will support it
uidString = uidString.replace(':', '_');
return uidString;
}