Fix JavaWriter.stringLiteral

JavaWriter.stringLiteral did not handle escapes correctly. Fixing the bug and extending to support escaping of control chars.