[
https://issues.apache.org/jira/browse/AVRO-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829319#action_12829319
]
Kevin Oliver commented on AVRO-393:
-----------------------------------
While its not obvious, the work around is to use something like this:
{code}
byte[] myBytes = ...;
Utf8 utf8 = new Utf8();
utf8.setLength(myBytes.length);
System.arraycopy(myBytes, 0, utf8.getBytes(), 0, myBytes.length);
{code}
That said, I agree that a Utf8(byte[]) constructor would be useful.
> byte[] constructor for Utf8 desired
> -----------------------------------
>
> Key: AVRO-393
> URL: https://issues.apache.org/jira/browse/AVRO-393
> Project: Avro
> Issue Type: New Feature
> Reporter: Jeff Hodges
> Assignee: Jeff Hodges
> Priority: Minor
> Attachments: byte_utf8.patch
>
>
> We've come across a few use cases where we know that a given byte array is
> properly Utf8 encoded, but Utf8 has no constructor to take it. Instead, we
> have to turn it into a String first just to have it swapped back. This is
> sucky.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.