aherbert commented on a change in pull request #49:
URL: https://github.com/apache/commons-codec/pull/49#discussion_r447728765



##########
File path: src/main/java/org/apache/commons/codec/binary/Hex.java
##########
@@ -148,12 +169,62 @@
     protected static char[] encodeHex(final byte[] data, final char[] 
toDigits) {
         final int l = data.length;
         final char[] out = new char[l << 1];
+        encodeHex(data, 0, data.length, toDigits, out, 0);
+        return out;
+    }
+
+    /**
+     * Converts an array of bytes into an array of characters representing the 
hexadecimal values of each byte in order.
+     *
+     * @param data a byte[] to convert to Hex characters
+     * @param dataOffset the position in {@code data} to start encoding from
+     * @param dataLen the number of bytes from {@code dataOffset} to encode
+     * @param toLowerCase {@code true} converts to lowercase, {@code false} to 
uppercase
+     * @return A char[] containing the appropriate characters from the 
alphabet For best results, this should be either
+     *         upper- or lower-case hex.
+     * @since 1.15
+     */
+    protected static char[] encodeHex(final byte[] data, final int dataOffset, 
final int dataLen,

Review comment:
       Should be public

##########
File path: src/main/java/org/apache/commons/codec/binary/Hex.java
##########
@@ -148,12 +169,62 @@
     protected static char[] encodeHex(final byte[] data, final char[] 
toDigits) {
         final int l = data.length;
         final char[] out = new char[l << 1];
+        encodeHex(data, 0, data.length, toDigits, out, 0);
+        return out;
+    }
+
+    /**
+     * Converts an array of bytes into an array of characters representing the 
hexadecimal values of each byte in order.
+     *
+     * @param data a byte[] to convert to Hex characters
+     * @param dataOffset the position in {@code data} to start encoding from
+     * @param dataLen the number of bytes from {@code dataOffset} to encode
+     * @param toLowerCase {@code true} converts to lowercase, {@code false} to 
uppercase
+     * @return A char[] containing the appropriate characters from the 
alphabet For best results, this should be either
+     *         upper- or lower-case hex.
+     * @since 1.15
+     */
+    protected static char[] encodeHex(final byte[] data, final int dataOffset, 
final int dataLen,
+            final boolean toLowerCase) {
+        final char[] out = new char[dataLen << 1];
+        encodeHex(data, dataOffset, dataLen, toLowerCase ? DIGITS_LOWER : 
DIGITS_UPPER, out, 0);
+        return out;
+    }
+
+    /**
+     * Converts an array of bytes into an array of characters representing the 
hexadecimal values of each byte in order.
+     *
+     * @param data a byte[] to convert to Hex characters
+     * @param dataOffset the position in {@code data} to start encoding from
+     * @param dataLen the number of bytes from {@code dataOffset} to encode
+     * @param toLowerCase {@code true} converts to lowercase, {@code false} to 
uppercase
+     * @param out a char[] which will hold the resultant appropriate 
characters from the alphabet.
+     * @param outOffset the position within {@code out} at which to start 
writing the encoded characters.
+     * @since 1.15
+     */
+    protected static void encodeHex(final byte[] data, final int dataOffset, 
final int dataLen,

Review comment:
       Should be public




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to