ByteBufferInputStream.read doesn't properly convert bytes, backport #1333