Merge pull request #657 from google/jw/no-io
There is no I/O writing to a StringWriter.
This commit is contained in:
commit
e8e8b557d2
|
@ -211,9 +211,13 @@ public abstract class TypeAdapter<T> {
|
||||||
* @param value the Java object to convert. May be null.
|
* @param value the Java object to convert. May be null.
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
public final String toJson(T value) throws IOException {
|
public final String toJson(T value) {
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
toJson(stringWriter, value);
|
try {
|
||||||
|
toJson(stringWriter, value);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new AssertionError(e); // No I/O writing to a StringWriter.
|
||||||
|
}
|
||||||
return stringWriter.toString();
|
return stringWriter.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user