Backport Implement part of java.nio.{Byte,Char}Buffer.

These are required to implement Charset encoders and decoders.

Backport: Move tests: scala.scalajs.{testsuite => test}.niobuffer

(cherry picked from commit 706d29a34ada59282cd11c7b179fe8b4ce7b598e)