[ 
https://issues.apache.org/jira/browse/LANG-778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13156648#comment-13156648
 ] 

Joerg Schaible edited comment on LANG-778 at 11/24/11 11:40 AM:
----------------------------------------------------------------

Maybe I have an even better idea: Let's ditch UUIDUtils and create ByteUtils 
instead! Proposed API:

{noformat}
byte[] ByteUtils.getBytes(TYPE value);
void ByteUtils.write(TYPE value, byte[] bytes, int offset);
TYPE ByteUtils.readTYPE(byte[] bytes);
TYPE ByteUtils.readTYPE(byte[] bytes, int offset);
{noformat}

Proposed initial implementations for TYPE: short, int, long, UUID
Byte sequence generated as described for DataInput/DataOutput (big endian).
                
      was (Author: joehni):
    Maybe I have an even better idea: Let's ditch UUIDUtils and create 
ByteUtils instead! Proposed API:

 byte[] ByteUtils.getBytes(TYPE value);
 void ByteUtils.write(TYPE value, byte[] bytes, int offset);
 TYPE ByteUtils.readTYPE(byte[] bytes);
 TYPE ByteUtils.readTYPE(byte[] bytes, int offset);

Proposed initial implementations for TYPE: short, int, long, UUID
Byte sequence generated as described for DataInput/DataOutput (big endian).
                  
> Add UUIDUtils.toByteArray and UUIDUtils.fromByteArray
> -----------------------------------------------------
>
>                 Key: LANG-778
>                 URL: https://issues.apache.org/jira/browse/LANG-778
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Joerg Schaible
>            Assignee: Joerg Schaible
>            Priority: Minor
>         Attachments: LANG-778.diff
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> A UUID represents 16 bytes. In some situation (e.g. using DBs that do not 
> have native support for the type UUID) it is necessary to use directly the 
> bytes. The JDK does not support the transformation from UUID to bytes and 
> back, therefore I'd like to add UUIDUtils with the two proposed methods.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to