@Override protected ContentHandler getContentHandler(String targetMimeType, Writer output) throws TransformerConfigurationException { if (MimetypeMap.MIMETYPE_TEXT_CSV.equals(targetMimeType)) { return new CsvContentHandler(output); } // Otherwise use the normal Tika rules return super.getContentHandler(targetMimeType, output); }
/** * Can we do the requested transformation via Tika? We support transforming to HTML, XML, Text or * CSV */ @Override public boolean isTransformableMimetype( String sourceMimetype, String targetMimetype, TransformationOptions options) { if (sourceMimeTypes.contains(sourceMimetype) && MimetypeMap.MIMETYPE_TEXT_CSV.equals(targetMimetype)) { // Special case for CSV return true; } // Otherwise fall back on the default Tika rules return super.isTransformableMimetype(sourceMimetype, targetMimetype, options); }