@SuppressWarnings("nls")
	public static final String reflow(String text) {
		if (text == null) {
			return "";
		}
		int count = 0;
		StringBuilder buffer = new StringBuilder();
		StringTokenizer tokenizer = new StringTokenizer(text.replaceAll("[\\x00-\\x08]", "").replaceAll("[\\x0b\\x0c]", "").replaceAll("[\\x0e-\\x1f]", "").replaceAll("[\\x7f-\\x9f]", "").replaceAll("\r\n", "\n").replace('\r', '\n').replaceAll("[ \t\f]+", " ").trim(), "\n", true);
		while (tokenizer.hasMoreTokens()) {
			String token = tokenizer.nextToken();
			if (token.equals("\n")) {
				count++;
			} else {
				if (count == 1) {
					buffer.append(" ");
				} else if (count > 1) {
					buffer.append("\n\n");
				}
				count = 0;
				buffer.append(token);
			}
		}
		return buffer.toString();
	}