private static void writeString(final StringWriter writer, final String s) {
		writer.write('"');
		for(int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch(c) {
				case '"':
					writer.append("\\\"");
					break;
				case '\\':
					writer.append("\\\\");
					break;
				case '\b':
					writer.append("\\b");
					break;
				case '\f':
					writer.append("\\f");
					break;
				case '\n':
					writer.append("\\n");
					break;
				case '\r':
					writer.append("\\r");
					break;
				case '\t':
					writer.append("\\t");
					break;
				default:
					if(Character.isISOControl(c)) {
						writer.append(String.format("\\u%04x", c & 0xFFFF));
					}
					else {
						writer.append(c);
					}
			}
		}
		writer.write('"');
	}