<div dir="ltr">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 performance - I am for instance struggling with this in java.util.Base64 where the Encoders and Decoders lack a length parameter (also an offset would have been great even though I don't need that in my case). <div><br></div><div>In my system I adds data of unknown length to large buffers that in many cases only will be partially filled and when I need to BASE64 encode data in these buffers I now have to create new "right sized" byte arrays and copy the relevant data from the larger buffer to the new byte array. This is a waste of CPU time & memory access that I would be happy to avoid.   <br><div><br></div><div>In this specific case of the Encoders there exists already internal methods that accepts a length for the source buffer but these are private rather than protected preventing me from simply creating a subclass that adds such methods. Making JDK libraries a bit more subclassing friendly would also be great :-)</div></div><div><br></div><div>As it stands now I have created by own implementation of the Base64 class (from the JDK sources) that adds a method with the desired "length" parameter for use in my project but this is obviously not a good solution as I from now on needs to maintain this class and also misses out on improvements made to the original JDK library version...</div><div><br></div><div>/Trist</div></div>