public static String URLDecode ( byte [ ] bytes , String enc ) { if ( bytes == null ) { return ( null ) ; } int len = bytes . length ; int ix = 0 ; int ox = 0 ; while ( ix < len ) { byte b = bytes [ ix ++ ] ; // Get byte to test if ( b == ' ' ) { b = ( byte ) ' ' ; } else if ( b == ' ' ) { b = ( byte ) ( ( convertHexDigit ( bytes [ ix ++ ] ) << 4 ) + convertHexDigit ( bytes [ ix ++ ] ) ) ; } bytes [ ox ++ ] = b ; } if ( enc != null ) { try { return new String ( bytes , 0 , ox , enc ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } return new String ( bytes , 0 , ox ) ; }
Decode and return the specified URL - encoded byte array .