class FormEncodingProvider extends AbstractConfigurableProvider implements MessageBodyReader<T>, MessageBodyWriter<T> {

    @SuppressWarnings("unchecked")
    public void writeTo(T obj, Class<?> c, Type t, Annotation[] anns,
                        MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
        throws IOException, WebApplicationException {

        MultivaluedMap<String, String> map =
            (MultivaluedMap<String, String>)(obj instanceof Form ? ((Form)obj).asMap() : obj);
        boolean encoded = keepEncoded(anns);

        String enc = HttpUtils.getSetEncoding(mt, headers, StandardCharsets.UTF_8.name());

        FormUtils.writeMapToOutputStream(map, os, enc, encoded);

    }

    public  FormEncodingProvider();
    public  FormEncodingProvider(boolean expectEncoded);

}