[EMAIL PROTECTED] wrote:
...
For example:

            byte[] stringBytes = new byte[length];
            buffer.get(stringBytes, 0, length);
            char[] stringChars = new char[length];
            for (int i = 0; i < stringChars.length; i++)
            {
                stringChars[i] = (char) stringBytes[i];
            }
            return new String(stringChars);

Although it looks a bit cumbersome it is five times faster (from my measurements) than constructing the String directly from a byte array.

Thanks!  I needed this for something I'm working on, too.

Enrique

Reply via email to