本文整理匯總了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;
}