Java Code Examples for org.springframework.util.StringUtils.trimTrailingCharacter()

The following are Jave code examples for showing how to use trimTrailingCharacter() of the org.springframework.util.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: zkAdmin   File: ZookeeperManager.java   View Source Code Vote up 5 votes
private void recursiveCreate(ZooKeeper zk,String path,byte[] data) throws KeeperException, InterruptedException {
    if ("/".equals(path.trim())) return;
    path = StringUtils.trimTrailingCharacter(path, '/');
    Stack<String> paths = buildPathStack(path);
    byte[] tempdata = "".getBytes();
    while (!paths.empty()) {
        String elPath = paths.pop();
        Stat stat = zk.exists(elPath, false);
        if (paths.isEmpty()) tempdata = data;
        if (stat == null)zk.create(elPath, tempdata, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
    }
}