3939public class Hex implements BinaryEncoder , BinaryDecoder {
4040
4141 /**
42- * Default charset name is {@link Charsets#UTF_8}
42+ * Default charset is {@link Charsets#UTF_8}
4343 *
4444 * @since 1.7
4545 */
@@ -120,7 +120,7 @@ public static byte[] decodeHex(final char[] data) throws DecoderException {
120120 *
121121 * @param data
122122 * a byte[] to convert to Hex characters
123- * @return A char[] containing hexadecimal characters
123+ * @return A char[] containing lower-case hexadecimal characters
124124 */
125125 public static char [] encodeHex (final byte [] data ) {
126126 return encodeHex (data , true );
@@ -133,7 +133,7 @@ public static char[] encodeHex(final byte[] data) {
133133 *
134134 * @param data
135135 * a byte buffer to convert to Hex characters
136- * @return A char[] containing hexadecimal characters
136+ * @return A char[] containing lower-case hexadecimal characters
137137 * @since 1.11
138138 */
139139 public static char [] encodeHex (final ByteBuffer data ) {
@@ -149,7 +149,7 @@ public static char[] encodeHex(final ByteBuffer data) {
149149 * a byte[] to convert to Hex characters
150150 * @param toLowerCase
151151 * <code>true</code> converts to lowercase, <code>false</code> to uppercase
152- * @return A char[] containing hexadecimal characters
152+ * @return A char[] containing hexadecimal characters in the selected case
153153 * @since 1.4
154154 */
155155 public static char [] encodeHex (final byte [] data , final boolean toLowerCase ) {
@@ -165,7 +165,7 @@ public static char[] encodeHex(final byte[] data, final boolean toLowerCase) {
165165 * a byte buffer to convert to Hex characters
166166 * @param toLowerCase
167167 * <code>true</code> converts to lowercase, <code>false</code> to uppercase
168- * @return A char[] containing hexadecimal characters
168+ * @return A char[] containing hexadecimal characters in the selected case
169169 * @since 1.11
170170 */
171171 public static char [] encodeHex (final ByteBuffer data , final boolean toLowerCase ) {
@@ -180,8 +180,9 @@ public static char[] encodeHex(final ByteBuffer data, final boolean toLowerCase)
180180 * @param data
181181 * a byte[] to convert to Hex characters
182182 * @param toDigits
183- * the output alphabet
184- * @return A char[] containing hexadecimal characters
183+ * the output alphabet (must contain at least 16 chars)
184+ * @return A char[] containing the appropriate characters from the alphabet
185+ * For best results, this should be either upper- or lower-case hex.
185186 * @since 1.4
186187 */
187188 protected static char [] encodeHex (final byte [] data , final char [] toDigits ) {
@@ -203,8 +204,9 @@ protected static char[] encodeHex(final byte[] data, final char[] toDigits) {
203204 * @param data
204205 * a byte buffer to convert to Hex characters
205206 * @param toDigits
206- * the output alphabet
207- * @return A char[] containing hexadecimal characters
207+ * the output alphabet (must be at least 16 characters)
208+ * @return A char[] containing the appropriate characters from the alphabet
209+ * For best results, this should be either upper- or lower-case hex.
208210 * @since 1.11
209211 */
210212 protected static char [] encodeHex (final ByteBuffer data , final char [] toDigits ) {
@@ -217,7 +219,7 @@ protected static char[] encodeHex(final ByteBuffer data, final char[] toDigits)
217219 *
218220 * @param data
219221 * a byte[] to convert to Hex characters
220- * @return A String containing hexadecimal characters
222+ * @return A String containing lower-case hexadecimal characters
221223 * @since 1.4
222224 */
223225 public static String encodeHexString (final byte [] data ) {
@@ -230,7 +232,7 @@ public static String encodeHexString(final byte[] data) {
230232 *
231233 * @param data
232234 * a byte buffer to convert to Hex characters
233- * @return A String containing hexadecimal characters
235+ * @return A String containing lower-case hexadecimal characters
234236 * @since 1.11
235237 */
236238 public static String encodeHexString (final ByteBuffer data ) {
@@ -366,7 +368,7 @@ public Object decode(final Object object) throws DecoderException {
366368 *
367369 * @param array
368370 * a byte[] to convert to Hex characters
369- * @return A byte[] containing the bytes of the hexadecimal characters
371+ * @return A byte[] containing the bytes of the lower-case hexadecimal characters
370372 * @since 1.7 No longer throws IllegalStateException if the charsetName is invalid.
371373 * @see #encodeHex(byte[])
372374 */
@@ -386,7 +388,7 @@ public byte[] encode(final byte[] array) {
386388 *
387389 * @param array
388390 * a byte buffer to convert to Hex characters
389- * @return A byte[] containing the bytes of the hexadecimal characters
391+ * @return A byte[] containing the bytes of the lower-case hexadecimal characters
390392 * @see #encodeHex(byte[])
391393 * @since 1.11
392394 */
@@ -405,7 +407,7 @@ public byte[] encode(final ByteBuffer array) {
405407 *
406408 * @param object
407409 * a String, ByteBuffer, or byte[] to convert to Hex characters
408- * @return A char[] containing hexadecimal characters
410+ * @return A char[] containing lower-case hexadecimal characters
409411 * @throws EncoderException
410412 * Thrown if the given object is not a String or byte[]
411413 * @see #encodeHex(byte[])
0 commit comments