use of org.apache.sis.metadata.iso.DefaultMetadata in project tika by apache.
the class GeographicInformationParser method parse.
@Override
public void parse(InputStream inputStream, ContentHandler contentHandler, Metadata metadata, ParseContext parseContext) throws IOException, SAXException, TikaException {
metadata.set(Metadata.CONTENT_TYPE, geoInfoType);
DataStore dataStore = null;
DefaultMetadata defaultMetadata = null;
XHTMLContentHandler xhtmlContentHandler = new XHTMLContentHandler(contentHandler, metadata);
TemporaryResources tmp = TikaInputStream.isTikaInputStream(inputStream) ? null : new TemporaryResources();
try {
TikaInputStream tikaInputStream = TikaInputStream.get(inputStream, tmp);
File file = tikaInputStream.getFile();
dataStore = DataStores.open(file);
defaultMetadata = new DefaultMetadata(dataStore.getMetadata());
if (defaultMetadata != null)
extract(xhtmlContentHandler, metadata, defaultMetadata);
} catch (UnsupportedStorageException e) {
throw new TikaException("UnsupportedStorageException", e);
} catch (DataStoreException e) {
throw new TikaException("DataStoreException", e);
} finally {
if (tmp != null) {
tmp.dispose();
}
}
}
Aggregations