private void writeToChannel(WritableByteChannel writeableChannel, byte[] data)
      throws IOException {
    ByteBuffer buffer = ByteBuffer.wrap(data);
    int bytesWritten = 0;
    while (bytesWritten < data.length) {
      bytesWritten += writeableChannel.write(buffer);
    }
  }
Writes {@code data} to {@code writeableChannel}.
java_src/src/test/java/com/google/crypto/tink/streamingaead/StreamingAeadTest.java