Discussion: Efficient ByteBuffer -> String that avoids additional copying

Jacob Glickman jhg023 at bucknell.edu
Wed May 16 16:42:46 UTC 2018


Paul,

Would you mind explaining more about what you're looking for regarding
this?  I'm curious if `ByteBuffer#getString` is what you're after, or
rather something similar to `String.from(ByteBuffer)`.  I'll definitely
have a look at jdk.internal.misc.SharedSecrets in the meantime.  Thanks!

- Jacob

>Hi Jacob,
>I do have one idea (that i don’t think is currently represented as a bug,
though i have not searched JBS), if you are willing to take it on. It will
require some investigation, and careful testing, it’s not necessarily a
starter bug :-), but i can help guide.
>Investigate new methods to more efficiently support ByteBuffer -> String
method on ByteBuffer that can avoid additional copying and makeappropriate
use of charsets given String’s compact string support. You need to look at
jdk.internal.misc.SharedSecrets for clues on how to trampoline between the
nio and lang packages.
>Paul.


More information about the core-libs-dev mailing list