mirror of
https://github.com/fankes/moshi.git
synced 2025-10-19 07:59:21 +08:00
Merge pull request #57 from square/jw/no-io
There is no I/O writing to a Buffer.
This commit is contained in:
@@ -44,9 +44,13 @@ public abstract class JsonAdapter<T> {
|
|||||||
toJson(writer, value);
|
toJson(writer, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String toJson(T value) throws IOException {
|
public final String toJson(T value) {
|
||||||
Buffer buffer = new Buffer();
|
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();
|
return buffer.readUtf8();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user