@Test public void serializeString() throws Exception { verifyRoundTrip("foo"); }
private void serializeString(String string) { writer.print("\""); String backslashesReplaced = backslashPattern.matcher(string).replaceAll(backslashReplacement); String quotesReplaced = quotePattern.matcher(backslashesReplaced).replaceAll(quoteReplacement); String newlinesReplaced = newlinePattern.matcher(quotesReplaced).replaceAll(newlineReplacement); writer.print(newlinesReplaced); writer.print("\""); }
JsonWriter { private void serializeString(String string) { writer.print("\""); String backslashesReplaced = backslashPattern.matcher(string).replaceAll(backslashReplacement); String quotesReplaced = quotePattern.matcher(backslashesReplaced).replaceAll(quoteReplacement); String newlinesReplaced = newlinePattern.matcher(quotesReplaced).replaceAll(newlineReplacement); writer.print(newlinesReplaced); writer.print("\""); } }
JsonWriter { private void serializeString(String string) { writer.print("\""); String backslashesReplaced = backslashPattern.matcher(string).replaceAll(backslashReplacement); String quotesReplaced = quotePattern.matcher(backslashesReplaced).replaceAll(quoteReplacement); String newlinesReplaced = newlinePattern.matcher(quotesReplaced).replaceAll(newlineReplacement); writer.print(newlinesReplaced); writer.print("\""); } JsonWriter(OutputStream outputStream); }
JsonWriter { private void serializeString(String string) { writer.print("\""); String backslashesReplaced = backslashPattern.matcher(string).replaceAll(backslashReplacement); String quotesReplaced = quotePattern.matcher(backslashesReplaced).replaceAll(quoteReplacement); String newlinesReplaced = newlinePattern.matcher(quotesReplaced).replaceAll(newlineReplacement); writer.print(newlinesReplaced); writer.print("\""); } JsonWriter(OutputStream outputStream);  }
JsonWriter { private void serializeString(String string) { writer.print("\""); String backslashesReplaced = backslashPattern.matcher(string).replaceAll(backslashReplacement); String quotesReplaced = quotePattern.matcher(backslashesReplaced).replaceAll(quoteReplacement); String newlinesReplaced = newlinePattern.matcher(quotesReplaced).replaceAll(newlineReplacement); writer.print(newlinesReplaced); writer.print("\""); } JsonWriter(OutputStream outputStream);   }