PathUtils
Esta página aún no está disponible en tu idioma.
Utility methods to handle paths. For example, get the name or the parent path.
Methods
Section titled “Methods”getParent
Section titled “getParent”Description:
| Method | Return values | Description |
|---|---|---|
| getParent(String path) | String | Gets the parent node. |
- path: The path of the file.
Example:
package com.openkm;
import com.openkm.util.ContextWrapper;import com.openkm.util.PathUtils;
public class Test {
public static void main(String[] args) { try { System.out.println(PathUtils.getParent("/okm:root/logo.png")); } catch (Exception e) { e.printStackTrace(); } }}getName
Section titled “getName”Description:
| Method | Return values | Description |
|---|---|---|
| getName(String path) | String | Gets the node name. |
- path: The path of the file.
Example:
package com.openkm;
import com.openkm.util.ContextWrapper;import com.openkm.util.PathUtils;
public class Test {
public static void main(String[] args) { try { System.out.println(PathUtils.getName("/okm:root/logo.png")); } catch (Exception e) { e.printStackTrace(); } }}getContext
Section titled “getContext”Description:
| Method | Return values | Description |
|---|---|---|
| getContext(String path) | String | Gets the path context. For example “/okm:root/test.txt” -> “/okm:root”. |
- path: The path of the file.
Example:
package com.openkm;
import com.openkm.util.ContextWrapper;import com.openkm.util.PathUtils;
public class Test {
public static void main(String[] args) { try { System.out.println(PathUtils.getContext("/okm:root/logo.png")); } catch (Exception e) { e.printStackTrace(); } }}