docs: public void writeField(String field) throws IOException {
  
  		if (this.newLine) {
  			this.newLine = false;
  		} else {
  			this.write(',');
  		}
  
  		// case 0: empty string, simple :)
  		if ((field == null) || (field.length() == 0)) {
  			return;
  		}
  
  		// case 1: field has quotes in it, if so convert to, quote field and
  		// double all quotes
  		Matcher matcher = escapePattern.matcher(field);
  		if (matcher.find()) {
  			this.write('"');
  			this.tmpBuffer.setLength(0);
  			do {
  				matcher.appendReplacement(this.tmpBuffer, "\"\"");
  			} while (matcher.find());
  			matcher.appendTail(this.tmpBuffer);
  			this.write(this.tmpBuffer.toString());
  			this.write('"');
  			return;
  		}
  
  		// case 2: field has a comma, carriage return or new line in it, if so
  		// quote field and double all quotes
  		matcher = specialCharsPattern.matcher(field);
  		if (matcher.find()) {
  			this.write('"');
  			this.write(field);
  			this.write('"');
  			return;
  		}
  
  		// case 3: safe string to just add
  		this.append(field);
  	}