net.netheos.pcsapi.models
Class CPath

java.lang.Object
  extended by net.netheos.pcsapi.models.CPath

public class CPath
extends Object

Immutable remote file pathname, with methods for easier handling.

path components are separated by a single slash. A path is always unicode and normalized so that it begins by a leading slash and never ends with a trailing slash, except for root path : '/'. Anti slashes are forbidden in CPath objects.


Field Summary
static CPath ROOT
           
 
Constructor Summary
CPath(String pathName)
           
 
Method Summary
 CPath add(String baseName)
          Adds a component to the current path
 boolean equals(Object obj)
           
 String getBaseName()
          Return last element of this path as string (empty string if this object is root path)
 CPath getParent()
           
 String getPathName()
          Get the path name
 String getUrlEncoded()
          URL encode the path
 int hashCode()
           
 boolean isRoot()
          Indicates if this path is the root in the filesystem
 List<String> split()
          Split this path : "a/b/c" --> "a", "b", "c".
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT

public static final CPath ROOT
Constructor Detail

CPath

public CPath(String pathName)
Method Detail

getUrlEncoded

public String getUrlEncoded()
URL encode the path

Returns:
this full path string encoded for URL path (slashes are not encoded)

getBaseName

public String getBaseName()
Return last element of this path as string (empty string if this object is root path)

Returns:
last element of this path as string (empty string if this object is root path)

isRoot

public boolean isRoot()
Indicates if this path is the root in the filesystem

Returns:
true if this path is the root path

split

public List<String> split()
Split this path : "a/b/c" --> "a", "b", "c".

Returns:
a list of segments for this path (empty list for root path)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getPathName

public String getPathName()
Get the path name

Returns:
The path name

toString

public String toString()
Overrides:
toString in class Object

getParent

public CPath getParent()
Returns:
CPath of this parent folder, or root folder if this path is root folder

add

public CPath add(String baseName)
Adds a component to the current path

Parameters:
baseName -
Returns:
the new path with the


Copyright © 2014. All Rights Reserved.