Java Path Concatenate concatPath(String root, String node)

Here you can find the source of concatPath(String root, String node)

Description

concat Path

License

Apache License

Declaration

public static String concatPath(String root, String node) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final String NODE_SEPERATOR = "/";

    public static String concatPath(String root, String node) {
        if (root == null) {
            root = NODE_SEPERATOR;//from w w w. j a  v  a 2  s .  c o  m
        }
        if (!root.startsWith(NODE_SEPERATOR)) {
            throw new RuntimeException("path should be start with a /");
        }

        if (!root.endsWith(NODE_SEPERATOR)) {
            root = root + NODE_SEPERATOR;
        }

        return root + node;
    }
}

Related

  1. concatPath(String path1, String path2)
  2. concatPath(String path1, String path2)
  3. concatPath(String path1, String path2)
  4. concatPath(String pathName, String name)
  5. concatPath(String root, String fragment)
  6. concatPath(String src, String dst)
  7. concatPath(String... path)
  8. concatPaths(String path1, String path2)
  9. concatPaths(String path1, String path2)