+ encodeString(out, car);
+ }
+ out.write('\"');
+ }
+
+ // aa bb -> "aa\tbb"
+ static void encodeString(OutputStream out, InputStream raw)
+ throws IOException {
+ out.write('\"');
+ byte buffer[] = new byte[4096];
+ for (int len = 0; (len = raw.read(buffer)) > 0;) {
+ for (int i = 0; i < len; i++) {
+ // TODO: not 100% correct, look up howto for UTF-8
+ encodeString(out, (char) buffer[i]);