Anonymous avatar Anonymous committed 89a4298

Code style, commentary typo and formatting change only.

Comments (0)

Files changed (1)

src/org/python/core/util/StringUtil.java

-/* Copyright (c) 2007 Jython Developers */
+/* Copyright (c) 2012 Jython Developers */
 package org.python.core.util;
 
 import java.io.UnsupportedEncodingException;
 import java.nio.ByteBuffer;
 
-import org.python.core.BufferPointer;
+import org.python.core.BaseBytes;
 import org.python.core.Py;
-import org.python.core.BaseBytes;
 import org.python.core.PyBuffer;
 
 /**
 public class StringUtil {
 
     /**
-     * Encodes this String into a sequence of bytes. Each byte
-     * contains the low-order bits of its corresponding char.
+     * Encodes this String into a sequence of bytes. Each byte contains the low-order bits of its
+     * corresponding char.
      *
      * @param string a String value
      * @return a byte array with one byte for each char in string
     public static byte[] toBytes(String string) {
         try {
             return string.getBytes("ISO-8859-1");
-        } catch(UnsupportedEncodingException uee) {
+        } catch (UnsupportedEncodingException uee) {
             // This JVM is whacked, it doesn't even have iso-8859-1
             throw Py.SystemError("Java couldn't find the ISO-8859-1 encoding");
         }
     }
 
     /**
-     * Return a new String with chars corresponding to buf from off to
-     * off + len.
+     * Return a new String with chars corresponding to buf from off to off + len.
      *
      * @param buf an array of bytes
      * @param off the initial offset
      */
     @SuppressWarnings("deprecation")
     public static String fromBytes(byte[] buf, int off, int len) {
-        // Yes, I known the method is deprecated, but it is the fastest
+        // Yes, I know the method is deprecated, but it is the fastest
         // way of converting between between byte[] and String
         return new String(buf, 0, off, len);
     }
      */
     public static String fromBytes(ByteBuffer buf) {
         return fromBytes(buf.array(), buf.arrayOffset() + buf.position(),
-                         buf.arrayOffset() + buf.limit());
+                buf.arrayOffset() + buf.limit());
     }
 
     /**
      */
     public static String fromBytes(BaseBytes b) {
 
-         int size = b.__len__();
-         StringBuilder buf = new StringBuilder(size);
-         for (int j = 0; j < size; j++)  buf.append((char) b.intAt(j));
-         return buf.toString();
-     }
+        int size = b.__len__();
+        StringBuilder buf = new StringBuilder(size);
+        for (int j = 0; j < size; j++) {
+            buf.append((char)b.intAt(j));
+        }
+        return buf.toString();
+    }
 
-    /** Decapitalize a String if it begins with a capital letter, e.g.:
-     * FooBar -> fooBar
+    /**
+     * Decapitalize a String if it begins with a capital letter, e.g.: FooBar -> fooBar
      *
      * @param string a String
      * @return a decapitalized String
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.