common/src/main/java/HTTPClient/Codecs.java
/**
     * This method does a quoted-printable encoding of the given string
     * according to RFC-2045 (Section 6.7). <em>Note:</em> this assumes
     * 8-bit characters.
     *
     * @param  str the string
     * @return the quoted-printable encoded string
     */
This method does a quoted-printable encoding of the given string
according to RFC-2045 (Section 6.7). Note: this assumes
8-bit characters.

@param  str the string
@return the quoted-printable encoded string
This method does a quoted - printable encoding of the given string according to RFC - 2045 ( Section 6 . 7 ) . Note : this assumes 8 - bit characters . @param str the string @return the quoted - printable encoded string
public final static String quotedPrintableEncode(String str)
    {
	if (str == null)  return  null;
	char map[] =
	    {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'},
	     nl[]  = System.getProperty("line.separator", "\n").toCharArray(),
	     res[] = new char[(int) (str.length()*1.5)],
	     src[] = str.toCharArray();
	char ch;
	int  cnt  = 0,
	     didx = 1,
	     last = 0,
	     slen = str.length();
	for (int sidx=0; sidx < slen; sidx++)
	{
	    ch = src[sidx];
	    if (ch == nl[0]   &&  match(src, sidx, nl))		
	    {
		if (res[didx-1] == ' ')			
		{
		    res[didx-1] = '=';
		    res[didx++] = '2';
		    res[didx++] = '0';
		}
		else if (res[didx-1] == '\t')		
		{
		    res[didx-1] = '=';
		    res[didx++] = '0';
		    res[didx++] = '9';
		}
		res[didx++] = '\r';
		res[didx++] = '\n';
		sidx += nl.length - 1;
		cnt = didx;
	    }
	    else if (ch > 126  ||  (ch < 32  &&  ch != '\t')  ||  ch == '='  ||
		     EBCDICUnsafeChar.get((int) ch))
	    {							
		res[didx++] = '=';
		res[didx++] = map[(ch & 0xf0) >>> 4];
		res[didx++] = map[ch & 0x0f];
	    }
	    else						
	    {
		res[didx++] = ch;
	    }
	    if (didx > cnt+70)					
	    {
		res[didx++] = '=';
		res[didx++] = '\r';
		res[didx++] = '\n';
		cnt = didx;
	    }
	    if (didx > res.length-5)
		res = Util.resizeArray(res, res.length+500);
	}
	return String.valueOf(res, 1, didx-1);
    }
public final static String quotedPrintableEncode ( String str ) { if ( str == null ) return null ; char map [ ] = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' } , nl [ ] = System . getProperty ( "line.separator" , "\n" ) . toCharArray ( ) , res [ ] = new char [ ( int ) ( str . length ( ) * 1.5 ) ] , src [ ] = str . toCharArray ( ) ; char ch ; int cnt = 0 , didx = 1 , last = 0 , slen = str . length ( ) ; for ( int sidx = 0 ; sidx < slen ; sidx ++ ) { ch = src [ sidx ] ; if ( ch == nl [ 0 ] && match ( src , sidx , nl ) ) { if ( res [ didx - 1 ] == ' ' ) { res [ didx - 1 ] = '=' ; res [ didx ++ ] = '2' ; res [ didx ++ ] = '0' ; } else if ( res [ didx - 1 ] == '\t' ) { res [ didx - 1 ] = '=' ; res [ didx ++ ] = '0' ; res [ didx ++ ] = '9' ; } res [ didx ++ ] = '\r' ; res [ didx ++ ] = '\n' ; sidx += nl . length - 1 ; cnt = didx ; } else if ( ch > 126 || ( ch < 32 && ch != '\t' ) || ch == '=' || EBCDICUnsafeChar . get ( ( int ) ch ) ) { res [ didx ++ ] = '=' ; res [ didx ++ ] = map [ ( ch & 0xf0 ) >>> 4 ] ; res [ didx ++ ] = map [ ch & 0x0f ] ; } else { res [ didx ++ ] = ch ; } if ( didx > cnt + 70 ) { res [ didx ++ ] = '=' ; res [ didx ++ ] = '\r' ; res [ didx ++ ] = '\n' ; cnt = didx ; } if ( didx > res . length - 5 ) res = Util . resizeArray ( res , res . length + 500 ) ; } return String . valueOf ( res , 1 , didx - 1 ) ; }
This method does a quoted-printable encoding of the given string
 according to RFC-2045 (Section 6.7).
This method does a quoted - printable encoding of the given string according to RFC - 2045 ( Section 6 . 7 ) .
// Rule #4 // Rule #3 // Rule #3 // Rule #1, #2 // Rule #1 // Rule #5