@Test public void testWriteTo() throws IOException { provider.writeTo(MOCK_OBJECT, MOCK_OBJECT.getClass(), MOCK_OBJECT.getClass(), new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, MAP, OS); assertEquals(MOCK_OBJECT_JSON, new String(OS.toByteArray())); }
@Override public void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException { JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, Charset.forName(UTF_8))); gson.toJson(src, type, writer); writer.close(); }
GsonMessageBodyWriter implements MessageBodyWriter<Object> { @Override public void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException { JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, Charset.forName(UTF_8))); gson.toJson(src, type, writer); writer.close(); } }
GsonMessageBodyWriter implements MessageBodyWriter<Object> { @Override public void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException { JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, Charset.forName(UTF_8))); gson.toJson(src, type, writer); writer.close(); }  }
GsonMessageBodyWriter implements MessageBodyWriter<Object> { @Override public void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException { JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, Charset.forName(UTF_8))); gson.toJson(src, type, writer); writer.close(); }  @Override boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override long getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream); void setGson(Gson gson); }
GsonMessageBodyWriter implements MessageBodyWriter<Object> { @Override public void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException { JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, Charset.forName(UTF_8))); gson.toJson(src, type, writer); writer.close(); }  @Override boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override long getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream); void setGson(Gson gson);  }