Java needs an immutable byte array wrapper
Keith Turner
keith at deenlo.com
Sat Nov 12 18:45:28 UTC 2016
On Sat, Nov 12, 2016 at 1:04 PM, John Rose <john.r.rose at oracle.com> wrote:
> On Nov 12, 2016, at 8:45 AM, Keith Turner <keith at deenlo.com> 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.
>
> http://fluo.apache.org/blog/2016/11/10/immutable-bytes/
>
>
> That's a good blog entry; thanks, especially the pointer to ByteString.
>
> Of course Java needs a type like that, but our story for immutability
> is still in flux, so folks are being cautious about adopting such features.
>
> In a similar vein, I would like to see the ability to freeze Java arrays
> (make them immutable), and (independently) add more API points
Is the concept of freezing byte arrays written up anywhere?
> to them. But the ideas are not fully baked yet.
>
> See also this application for immutable bytes:
> https://bugs.openjdk.java.net/browse/JDK-8161256
>
> — John
>
More information about the discuss
mailing list