public static String[] parsePath(String path,boolean decodeSteps) throws CharacterCodingException {
  ArrayList<String> arr=new ArrayList<String>();
  int firstPos=path.indexOf('/');
  while (firstPos >= 0) {
    String step;
    int nextPos=path.indexOf('/',firstPos + 1);
    if (nextPos < 0)     step=path.substring(firstPos + 1);
 else     step=path.substring(firstPos + 1,nextPos);
    if (decodeSteps)     step=UriTools.decodePath(step);
    arr.add(step);
    firstPos=nextPos;
  }
  int sz=arr.size();
  if (sz == 0)   return (EMPTY_STRING_ARRAY);
  return (arr.toArray(new String[sz]));
}

public static String [ ] parsePath ( String path , boolean decodeSteps ) throws CharacterCodingException { ArrayList < String > arr = new ArrayList < String > ( ) ; int firstPos = path . indexOf ( '/' ) ; while ( firstPos >= 0 ) { String step ; int nextPos = path . indexOf ( '/' , firstPos + 1 ) ; if ( nextPos < 0 ) step = path . substring ( firstPos + 1 ) ; else step = path . substring ( firstPos + 1 , nextPos ) ; if ( decodeSteps ) step = UriTools . decodePath ( step ) ; arr . add ( step ) ; firstPos = nextPos ; } int sz = arr . size ( ) ; if ( sz == 0 ) return ( EMPTY_STRING_ARRAY ) ; return ( arr . toArray ( new String [ sz ] ) ) ; }
parse a path consisting of a series of / delimited steps . the / characters are removed . if the string doesn ' t begin with a / , the component up to the first / is discarded . the path steps are decoded after being parsed .
