Java URL Encode urlPercentEncodeTwo(char c)

Here you can find the source of urlPercentEncodeTwo(char c)

Description

url Percent Encode Two

License

Apache License

Declaration

public static char[] urlPercentEncodeTwo(char c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final char[] HEX_TO_CHAR = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
            'E', 'F' };
    public static final char PERCENT_SYMBOL = '%';

    public static char[] urlPercentEncodeTwo(char c) {
        char[] result = null;
        int ci = c;
        int leftNibble = (0xF0 & ci) >> 4;
        int rightNibble = (0x0F & ci);
        result = new char[] { PERCENT_SYMBOL, HEX_TO_CHAR[leftNibble], HEX_TO_CHAR[rightNibble] };
        return result;
    }/*from  www. j  a va2  s . c  o m*/
}

Related

  1. urlEncodeForSpaces(String input)
  2. urlEncodeParameter(String value)
  3. URLEncoder(String str)
  4. urlEncodeSpace(String s)
  5. urlParameterEncode(String s)