Re: More support for offset and length in methods operating on byte arrays

2023-12-14 Thread Trist Post
Thanks for the good suggestion Pavel - will look into that - for large arrays absolutely less costly than copying! In the general case I would still prefer if the libraries generally provided offset & length for byte array arguments to allow for "garbage free" code (i.e. avoiding to frequently cre

Re: More support for offset and length in methods operating on byte arrays

2023-12-14 Thread Pavel Rappo
Yes, overloads that accepted both source and destination ByteBuffer were there at some point, but then were removed: commit 591834e28d482ea6a375ab215958e1635a7b111d Author: Xueming Shen Date: Tue Dec 3 17:44:31 2013 -0800 8028397: Undo the lenient MIME BASE64 decoder support change (JDK-8

Re: More support for offset and length in methods operating on byte arrays

2023-12-14 Thread Pavel Rappo
Upon a closer look, switching to ByteBuffer would only get you 50% towards where you want to be: the resulting ByteBuffer, whether encoded or decoded, is *allocated* by the respective methods and then returned as a result rather than accepted by those methods as a parameter. > On 14 Dec 2023, a

Re: More support for offset and length in methods operating on byte arrays

2023-12-14 Thread Pavel Rappo
> On 14 Dec 2023, at 06:10, Magnus wrote: > > In the java libraries there are many methods that operate on byte arrays that > do not allow you to specify offset and length for the relevant data instead > forcing you to copy the relevant part to new arrays before using the methods > reducing