ByteBuffer to CharBuffer

Pavel Rappo pavel.rappo at
Mon Feb 6 11:24:17 UTC 2017

Hi Jay,

1. I don't know if you've forgotten to attach the patch you mentioned or it has
been stripped by the mail list. In any case, if it's not too big, please inline
it in your next email.

2. A more appropriate place for this discussion would be another list: 

    nio-dev at openjdk dot java dot net

> On 6 Feb 2017, at 10:57, Jay <jay.sridhar at> wrote:
> java.nio.ByteBuffer provides a method asCharBuffer() which returns a
> "view" of the ByteBuffer as a character buffer. It however does not
> take any arguments. And there is no mention in the Javadocs as to how
> it converts from bytes to chars.
> 1. There should be a method ByteBuffer.asCharBuffer(CharSet) and/or
> ByteBuffer.asCharBuffer(String charSet) which allows the user to
> explicitly specify the character set to be used for conversion.
> 2. The method ByteBuffer.asCharBuffer() should mention that this
> method uses the platform default charset for bytes-to-chars
> conversion.
> I can provide a patch with these two changes. What do you guys think?
> -- 
> Regards
> Jay

More information about the core-libs-dev mailing list