/**
   * Prints a String to the log.
   *
   * @param buffer receiving byte buffer.
   * @param offset offset into the receiving buffer.
   * @param s the new string to be logged.
   * @return the new offset into the byte buffer.
   */
  private int print(byte[] buffer, int offset, String s) {
    int length = s.length();

    _cb.ensureCapacity(length);
    char[] cBuf = _cb.getBuffer();

    s.getChars(0, length, cBuf, 0);

    for (int i = length - 1; i >= 0; i--) buffer[offset + i] = (byte) cBuf[i];

    return offset + length;
  }