code: @Override
      public void writeTo(final Object entity,
                          final Class<?> type,
                          final Type genericType,
                          final Annotation[] annotations,
                          final MediaType mediaType,
                          final MultivaluedMap<String, Object> httpHeaders,
                          final OutputStream entityStream) throws IOException, WebApplicationException {
  
          if (entity != null) {
              Writer osw = new OutputStreamWriter(entityStream, getCharset(mediaType));
              String s = entity.toString();
              osw.write(s, 0, s.length());
              osw.flush();
          }
      }
docs: {@inheritDoc}