本文整理了Java中org.apache.gobblin.util.guid.Guid.deserialize()
方法的一些代码示例,展示了Guid.deserialize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.deserialize()
方法的具体详情如下:
包路径:org.apache.gobblin.util.guid.Guid
类名称:Guid
方法名:deserialize
[英]Reverse of #toString. Deserializes a Guid from a previously serialized one.
[中]与#toString相反。从先前序列化的Guid反序列化Guid。
代码示例来源:origin: apache/incubator-gobblin
/**
* Get guid in this state if available. This is the reverse operation of {@link #setWorkUnitGuid}.
* @param state State from which guid should be extracted.
* @return A byte array guid.
* @throws IOException
*/
public static Optional<Guid> getWorkUnitGuid(State state)
throws IOException {
if (state.contains(WORK_UNIT_GUID)) {
return Optional.of(Guid.deserialize(state.getProp(WORK_UNIT_GUID)));
}
return Optional.absent();
}
代码示例来源:origin: apache/incubator-gobblin
@Test
public void testSerDe() throws Exception {
Random random = new Random();
byte[] b = new byte[10];
random.nextBytes(b);
Guid guid = new Guid(b);
Assert.assertEquals(guid.toString().length(), 2 * Guid.GUID_LENGTH);
Assert.assertEquals(guid, Guid.deserialize(guid.toString()));
}
代码示例来源:origin: org.apache.gobblin/gobblin-data-management
/**
* Get guid in this state if available. This is the reverse operation of {@link #setWorkUnitGuid}.
* @param state State from which guid should be extracted.
* @return A byte array guid.
* @throws IOException
*/
public static Optional<Guid> getWorkUnitGuid(State state)
throws IOException {
if (state.contains(WORK_UNIT_GUID)) {
return Optional.of(Guid.deserialize(state.getProp(WORK_UNIT_GUID)));
}
return Optional.absent();
}
内容来源于网络,如有侵权,请联系作者删除!