作者热门文章
- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.facebook.zookeeper.ZkUtil.bytesToString()
方法的一些代码示例,展示了ZkUtil.bytesToString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtil.bytesToString()
方法的具体详情如下:
包路径:com.facebook.zookeeper.ZkUtil
类名称:ZkUtil
方法名:bytesToString
[英]Converts a byte array from ZooKeeper into a String.
[中]将ZooKeeper中的字节数组转换为字符串。
代码示例来源:origin: facebook/jcommon
public static String decode(byte[] byteData) {
return ZkUtil.bytesToString(byteData);
}
}
代码示例来源:origin: facebook/jcommon
private void printDetailed(String zNodePath)
throws InterruptedException, KeeperException {
Stat stat = new Stat();
byte[] rawData = getZk().getData(zNodePath, null, stat);
String data =
(rawData == null) ? "<NULL>" : "'" + ZkUtil.bytesToString(rawData) + "'";
System.out.print(String.format("%-40s ", zNodePath));
System.out.print(String.format("Data: %-20s ", data));
System.out.print(String.format("Data Length: %-5d ", stat.getDataLength()));
System.out.print(String.format("NumChildren: %-5d ", stat.getNumChildren()));
System.out.print(String.format("Children Changes: %-20d ", stat.getCversion()));
System.out.print(String.format("Ephemeral Owner: %-20d ", stat.getEphemeralOwner()));
System.out.print(String.format("Version: %-20d ", stat.getVersion()));
System.out.print(String.format("Time Modified: %-20d ", stat.getMtime()));
System.out.print(String.format("Time Created: %-20d", stat.getCtime()));
System.out.print("\n");
}
代码示例来源:origin: facebook/jcommon
private void internalPrunePersistent(
ZkGenericPath path, String keyword, Set<String> keepSet
) throws InterruptedException, KeeperException {
if (isEphemeral(path.toString())) {
// We should only be scanning persistent nodes (although we may delete
// ephemeral nodes in order to remove a parent persistent node)
return;
}
if (keepSet.contains(path.toString())) {
try {
ZooKeeperIface zk = getZk();
byte[] data = zk.getData(path.toString(), false, null);
if (data != null &&
keyword.equals(ZkUtil.bytesToString(data))
) {
zk.setData(path.toString(), new byte[0], -1);
}
List<String> children = zk.getChildren(path.toString(), null);
for (String child : children) {
internalPrunePersistent(path.appendChild(child), keyword, keepSet);
}
} catch (KeeperException.NoNodeException e) {
// If the node disappears while scanning it, then just ignore
}
} else {
deleteSubtree(path, keyword);
}
}
代码示例来源:origin: com.facebook.jcommon/zookeeper
public static String decode(byte[] byteData) {
return ZkUtil.bytesToString(byteData);
}
}
本文整理了Java中com.facebook.zookeeper.ZkUtil.bytesToString()方法的一些代码示例,展示了ZkUtil.bytesToString()的具体用法。这些代码
我是一名优秀的程序员,十分优秀!