@Override
    public int write(ByteBuffer src) throws IOException {
      checkIsOpen();
      // not the most efficient way
      int size = Math.min(buffer.remaining(), src.remaining());
      size = Math.min(size, maxChunkSize);
      byte[] bytes = new byte[size];
      src.get(bytes);
      buffer.put(bytes);
      return size;
    }
Implements a SeekableByteChannel for testing.

<p>The implementation is backed by a ByteBuffer.
java_src/src/main/java/com/google/crypto/tink/testing/StreamingTestUtil.java