Search in sources :

Example 1 with XMPMetadata

use of org.apache.tika.xmp.XMPMetadata in project tika by apache.

the class XMPMessageBodyWriter method writeTo.

@Override
public void writeTo(Metadata metadata, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
    try {
        Writer writer = new OutputStreamWriter(entityStream, UTF_8);
        XMPMetadata xmp = new XMPMetadata(metadata);
        writer.write(xmp.toString());
        writer.flush();
    } catch (TikaException e) {
        throw new IOException(e);
    }
    entityStream.flush();
}
Also used : TikaException(org.apache.tika.exception.TikaException) XMPMetadata(org.apache.tika.xmp.XMPMetadata) OutputStreamWriter(java.io.OutputStreamWriter) IOException(java.io.IOException) MessageBodyWriter(javax.ws.rs.ext.MessageBodyWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter)

Aggregations

IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 MessageBodyWriter (javax.ws.rs.ext.MessageBodyWriter)1 TikaException (org.apache.tika.exception.TikaException)1 XMPMetadata (org.apache.tika.xmp.XMPMetadata)1