class JAXBObjectEntityProvider implements EntityProvider<Object> {

    @Override
    public void writeTo(Object t,
                        Class<?> type,
                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException {
        try {
            JAXBContext jaxbContext = getJAXBContext(type, mediaType);
            Marshaller marshaller = jaxbContext.createMarshaller();
            String charset = getCharset(mediaType);
            if (!isNullOrEmpty(charset)) {
                marshaller.setProperty(Marshaller.JAXB_ENCODING, charset);
            }

            marshaller.marshal(t, entityStream);
        } catch (JAXBException e) {
            throw new IOException(String.format("Can't write to output stream, %s", e));
        }
    }

    public  JAXBObjectEntityProvider(@Context Providers providers);

}