You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/07/25 21:50:20 UTC

[jira] [Created] (CODEC-224) Add convenience API org.apache.commons.codec.binary.Hex.encodeHexString(byte[]|ByteBuffer, boolean)

Gary Gregory created CODEC-224:
----------------------------------

             Summary: Add convenience API org.apache.commons.codec.binary.Hex.encodeHexString(byte[]|ByteBuffer, boolean)
                 Key: CODEC-224
                 URL: https://issues.apache.org/jira/browse/CODEC-224
             Project: Commons Codec
          Issue Type: Improvement
            Reporter: Gary Gregory
            Assignee: Gary Gregory
             Fix For: 1.11


Add convenience APIs:

{{org.apache.commons.codec.binary.Hex.encodeHexString(byte[], boolean)}}:

{code:java}
    /**
     * Converts an array of bytes into a String representing the hexadecimal values of each byte in order. The returned
     * String will be double the length of the passed array, as it takes two characters to represent any given byte.
     *
     * @param data
     *            a byte[] to convert to Hex characters
     * @param toLowerCase
     *            <code>true</code> converts to lowercase, <code>false</code> to uppercase
     * @return A String containing lower-case hexadecimal characters
     * @since 1.11
     */
    public static String encodeHexString(final byte[] data, boolean toLowerCase)
{code}

{{org.apache.commons.codec.binary.Hex.encodeHexString(ByteBuffer, boolean)}}:

{code:java}
    /**
     * Converts a byte buffer into a String representing the hexadecimal values of each byte in order. The returned
     * String will be double the length of the passed array, as it takes two characters to represent any given byte.
     *
     * @param data
     *            a byte buffer to convert to Hex characters
     * @param toLowerCase
     *            <code>true</code> converts to lowercase, <code>false</code> to uppercase
     * @return A String containing lower-case hexadecimal characters
     * @since 1.11
     */
    public static String encodeHexString(final ByteBuffer data, boolean toLowerCase)
{code}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)