Then write a subclass of FilterWriter that implements its methods to convert each char to that notation and pass the converted strings on to its wrapped Writer. Something like this:public class SlashUWriter extends FilterWriter {
private Writer writer;
public SlashUWriter(Writer w) {
writer = w;
}
public void write(int c) {
writer.write("\\u");
String hex = Integer.toHexString(c);
while (hex.length() < 4) {
hex = "0" + hex;
}
writer.write(hex);
}
// override the other two "write" methods similarly
// override "flush" and "close" to flush and close the writer
}