private String encodePath(String path){
  StringBuilder buf=new StringBuilder(path.length());
  for (int i=0; i < path.length(); i++) {
    char c=path.charAt(i);
switch (c) {
case ' ':
{
        buf.append("%20");
        break;
      }
case '%':
{
      buf.append("%25");
      break;
    }
case ';':
{
    buf.append("%3B");
    break;
  }
default :
{
  buf.append(c);
}
}
}
return buf.toString();
}

private String encodePath ( String path ) { StringBuilder buf = new StringBuilder ( path . length ( ) ) ; for ( int i = 0 ; i < path . length ( ) ; i ++ ) { char c = path . charAt ( i ) ; switch ( c ) { case ' ' : { buf . append ( "%20" ) ; break ; } case '%' : { buf . append ( "%25" ) ; break ; } case ';' : { buf . append ( "%3B" ) ; break ; } default : { buf . append ( c ) ; } } } return buf . toString ( ) ; }
encodes given path by replacing all occurrences of space with ' % 20 ' , percent sign with ' % 25 ' and semicolon with ' % 3b ' .
