Re: ByteBuffer to CharBuffer

2017-02-07 Thread Jay
As a view of the underlying contents, I guess it is correct that no encoding is applied to coerce a ByteBuffer into a CharBuffer. Maybe the javadoc for ByteBuffer.asCharBuffer() can emphasize this point. It is a bit confusing that most places in the JDK where bytes are converted to chars, a Charset

Re: ByteBuffer to CharBuffer

2017-02-06 Thread Brian Burkhalter
Looping in nio-dev which, as Pavel noted, is the apt forum for this topic. Jonas’s response is correct. The concept of “view buffer” is specified by [1]. In particular the statement "A view buffer is simply another buffer whose content is backed by the byte buffer." at least to my interpretati

Re: ByteBuffer to CharBuffer

2017-02-06 Thread Jonas Konrad
From what I can tell, asCharBuffer behaves exactly like the other as*Buffer methods, meaning every char in the CharBuffer is represented by two bytes in the original ByteBuffer (big- or little-endian depending on ByteOrder of the ByteBuffer). This means bb.asCharBuffer().get() behaves like bb.g

Re: ByteBuffer to CharBuffer

2017-02-06 Thread Pavel Rappo
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 d