VectorDataNodeIO { public static String decodeTabString(String input) { StringBuilder sb = new StringBuilder(input.length() + 10); int numEscapes = 0; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c == '\\') { numEscapes++; sb.append(c); } else { if (c == 't' && numEscapes == 1) { sb.deleteCharAt(sb.length()-1); sb.append(DEFAULT_DELIMITER_CHAR); numEscapes = 0; } else if (c == 't' && numEscapes > 1) { sb.deleteCharAt(sb.length()-1); sb.append(c); numEscapes = 0; } else { 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 testDecodeTabString() { assertEquals("with\tTab", VectorDataNodeIO.decodeTabString("with\\tTab")); assertEquals("with 4 spaces", VectorDataNodeIO.decodeTabString("with 4 spaces")); assertEquals("with \\t escaped tab", VectorDataNodeIO.decodeTabString("with \\\\t escaped tab")); assertEquals("with\t2\ttabs", VectorDataNodeIO.decodeTabString("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")); }