docs: public static String convertNewLines(String string) {
      int index;
  
      // Replace with \n
      StringBuffer newStringBuffer = new StringBuffer();
      while ((index = string.indexOf('\n')) != -1) {
        if (index > 0) {
  	newStringBuffer.append(string.substring(0, index));
        }
        newStringBuffer.append('\\');
        newStringBuffer.append('n');
        if ((index + 1) < string.length()) {
  	string = string.substring(index + 1);
        } else {
  	string = "";
        }
      }
      newStringBuffer.append(string);
      string = newStringBuffer.toString();
  
      // Replace with \r
      newStringBuffer = new StringBuffer();
      while ((index = string.indexOf('\r')) != -1) {
        if (index > 0) {
  	newStringBuffer.append(string.substring(0, index));
        }
        newStringBuffer.append('\\');
        newStringBuffer.append('r');
        if ((index + 1) < string.length()){
  	string = string.substring(index + 1);
        } else {
  	string = "";
        }
      }
      newStringBuffer.append(string);
      return newStringBuffer.toString();
    }