Java needs an immutable byte array wrapper
keith at deenlo.com
Thu Jan 26 16:24:33 UTC 2017
On Thu, Jan 26, 2017 at 4:19 AM, Andrew Haley <aph at redhat.com> wrote:
> On 12/11/16 16:45, Keith Turner wrote:
>> While trying to design an API for Fluo, its become clear to me that
>> Java could really benefit from an immutable byte array wrapper.
>> Something like java.lang.String except for byte arrays instead of char
>> arrays. It would be nice if this new type interoperated well with
>> byte, String, ByteBuffer, InputStream, OutputStream etc.
>> I wrote the following blog post about my experiences with this issue
>> while designing an API for Fluo.
>> Is there any reason something like this should not be added to Java?
> Apart from bulking up core Java and its specification and TCK even
> more, no.
> But aren't we looking at this in the wrong way? I would have thought
> the Right Thing would be to make Protobuf’s ByteString into a library
> in its own right.
I agree that would be a good solution. It would be really nice to
have a library with really good api practices and no dependencies. I
discussed that at the end of the post. There is a minor drawback, w/o
something in java you will end up with multiple libraries like this
and interoperability will not be as good as if it were in Java.
However that being said, having this library would be infinitely
better than not having it.
I have been thinking about creating a library like this, I just have
not found the time. I'll see if I can get something started and
circle back asking for review from this community and the protobuf
More information about the discuss