You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2012/06/25 02:58:19 UTC

svn commit: r1353368 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java

Author: sebb
Date: Mon Jun 25 00:58:19 2012
New Revision: 1353368

URL: http://svn.apache.org/viewvc?rev=1353368&view=rev
Log:
Javadoc

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java?rev=1353368&r1=1353367&r2=1353368&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java Mon Jun 25 00:58:19 2012
@@ -258,9 +258,13 @@ public class URLEncodedUtils {
         return result.toString();
     }
 
+    /** Unreserved characters, i.e. alphanumeric, plus: _ - ! . ~ ' ( ) * */
     private static final BitSet UNRESERVED   = new BitSet(256);
+    /** Punctuation characters: , ; : $ & + = */
     private static final BitSet PUNCT        = new BitSet(256);
+    /** Characters which are safe to use, i.e. {@link #UNRESERVED} plus {@link #PUNCT}uation */
     private static final BitSet SAFE         = new BitSet(256);
+    /** Characters which are safe to use in a path, i.e. {@link #UNRESERVED} plus {@link #PUNCT}uation plus / @ */
     private static final BitSet PATHSAFE     = new BitSet(256);
 
     static {
@@ -384,10 +388,24 @@ public class URLEncodedUtils {
         return urlencode(content, charset != null ? charset : Consts.UTF_8, UNRESERVED);
     }
 
+    /**
+     * Encode a String using the {@link #SAFE} set of characters.
+     * 
+     * @param content the string to encode
+     * @param charset the charset to use
+     * @return the encoded string
+     */
     static String enc(final String content, final Charset charset) {
         return urlencode(content, charset, SAFE);
     }
 
+    /**
+     * Encode a String using the {@link #PATHSAFE} set of characters.
+     * 
+     * @param content the string to encode
+     * @param charset the charset to use
+     * @return the encoded string
+     */
     static String encPath(final String content, final Charset charset) {
         return urlencode(content, charset, PATHSAFE);
     }