VectorDataNodeIO { public static String encodeTabString(String input) { StringBuilder sb = new StringBuilder(input.length() + 10); boolean escapeMode = false; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c == DEFAULT_DELIMITER_CHAR) { sb.append(ESCAPE_STRING); escapeMode = false; } else { if (c == '\\') { escapeMode = true; } else { if (c == 't' && escapeMode) { sb.append('\\'); } escapeMode = false; } sb.append(c); } } return sb.toString(); }  static Converter[] getConverters(SimpleFeatureType simpleFeatureType); static String encodeTabString(String input); static String decodeTabString(String input); static VectorDataNode[] getVectorDataNodes(VectorDataNode vectorDataNode, boolean individualShapes, String attributeName); static final char DEFAULT_DELIMITER_CHAR; static final String ESCAPE_STRING; static final String NULL_TEXT; static final String FILENAME_EXTENSION; }
@Test public void testEncodeTabString() { assertEquals("with\\tTab", VectorDataNodeIO.encodeTabString("with\tTab")); assertEquals("with 4 spaces", VectorDataNodeIO.encodeTabString("with 4 spaces")); assertEquals("with \\\\t escaped tab", VectorDataNodeIO.encodeTabString("with \\t escaped tab")); assertEquals("with\\t2\\ttabs", VectorDataNodeIO.encodeTabString("with\t2\ttabs")); assertEquals("with \\d other char", VectorDataNodeIO.encodeTabString("with \\d other char")); assertEquals("with \\\\d other char", VectorDataNodeIO.encodeTabString("with \\\\d other char")); }