Author: toad
Date: 2006-12-12 00:25:21 +0000 (Tue, 12 Dec 2006)
New Revision: 11348

Modified:
   trunk/freenet/src/freenet/support/URLEncoder.java
Log:
Indent.

Modified: trunk/freenet/src/freenet/support/URLEncoder.java
===================================================================
--- trunk/freenet/src/freenet/support/URLEncoder.java   2006-12-12 00:24:26 UTC 
(rev 11347)
+++ trunk/freenet/src/freenet/support/URLEncoder.java   2006-12-12 00:25:21 UTC 
(rev 11348)
@@ -8,45 +8,45 @@
  * don't turn spaces into +'s, and we allow through non-ascii characters 
unless told not to.
  */
 public class URLEncoder {
-  // Moved here from FProxy by amphibian
-  final static String safeURLCharacters = 
"*-_./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
+       // Moved here from FProxy by amphibian
+       final static String safeURLCharacters = 
"*-_./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";

-  /**
-   * Encode a string for inclusion in a URI.
-   *
-   * @param  URL  String to encode
-   * @param force List of characters (in the form of a string) which must be 
encoded as well as the built-in.
-   * @return      HTML-safe version of string
-   */
-  public final static String encode(String URL, String force, boolean ascii) {
-    StringBuffer enc = new StringBuffer(URL.length());
-    for (int i = 0; i < URL.length(); ++i) {
-      char c = URL.charAt(i);
-      if (((safeURLCharacters.indexOf(c) >= 0) || ((!ascii) && c >= 0200)) 
-                 && (force == null || force.indexOf(c) < 0)) {
-        enc.append(c);
-      } else {
-       try {
-                       byte[] encoded = ("" + c).getBytes("UTF-8");
-                       for(int j=0;j<encoded.length;j++) {
-                               byte b = encoded[j];
-                               int x = b & 0xFF;
-                               if(x < 16)
-                                       enc.append("%0");
-                               else
-                                       enc.append('%');
-                               enc.append(Integer.toHexString(x));
+       /**
+        * Encode a string for inclusion in a URI.
+        *
+        * @param  URL  String to encode
+        * @param force List of characters (in the form of a string) which must 
be encoded as well as the built-in.
+        * @return      HTML-safe version of string
+        */
+       public final static String encode(String URL, String force, boolean 
ascii) {
+               StringBuffer enc = new StringBuffer(URL.length());
+               for (int i = 0; i < URL.length(); ++i) {
+                       char c = URL.charAt(i);
+                       if (((safeURLCharacters.indexOf(c) >= 0) || ((!ascii) 
&& c >= 0200))
+                                       && (force == null || force.indexOf(c) < 
0)) {
+                               enc.append(c);
+                       } else {
+                               try {
+                                       byte[] encoded = ("" + 
c).getBytes("UTF-8");
+                                       for (int j = 0; j < encoded.length; 
j++) {
+                                               byte b = encoded[j];
+                                               int x = b & 0xFF;
+                                               if (x < 16)
+                                                       enc.append("%0");
+                                               else
+                                                       enc.append('%');
+                                               
enc.append(Integer.toHexString(x));
+                                       }
+                               } catch (UnsupportedEncodingException e) {
+                                       throw new Error(e);
+                               }
                        }
-               } catch (UnsupportedEncodingException e) {
-                       throw new Error(e);
                }
-      }
-    }
-    return enc.toString();
-  }
+               return enc.toString();
+       }

-  public static String encode(String s) {
-       return encode(s, null, false);
-  }
+       public static String encode(String s) {
+               return encode(s, null, false);
+       }

 }


Reply via email to