undertow-io/undertow — pull request #158 by golovnin (2014-01-22 20:45:55+00:00)
Title: Avoids usage of String.getBytes() without specifying the charset.

If the JVM is executed using the charset “UTF-32LE”, then the string “0\r\n” is converted to [48, 0, 0, 0, 13, 0, 0, 0, 10, 0, 0, 0] instead of [48, 13, 10]. It uses also a more efficient code to convert an int into a hex string in US ASCII encoding. Integer.toHexString() is not very efficient in terms of memory consumption. It creates always a String object and two char arrays (one is a part of String object and the other is a temporal array with the length 32). The added function #putIntAsHexString() avoids creation of useless garbage.