There is no I/O writing to a Buffer.

This commit is contained in:
Jake Wharton
2015-06-17 00:16:03 -04:00
parent 455fa47f9b
commit a25508a85e

View File

@@ -44,9 +44,13 @@ public abstract class JsonAdapter<T> {
writer.flush();
}
public final String toJson(T value) throws IOException {
public final String toJson(T value) {
Buffer buffer = new Buffer();
toJson(buffer, value);
try {
toJson(buffer, value);
} catch (IOException e) {
throw new AssertionError(e); // No I/O writing to a Buffer.
}
return buffer.readUtf8();
}