/** * Extract the metadata only from the input stream. Depending on media type validation, * the detector could be run against input stream in order to ensure that parser supports this * type of content. * @param in input stream to extract the metadata from * @return the extracted metadata converted to SearchBean or null if extraction is not possible * or was unsuccessful */ public SearchBean extractMetadataToSearchBean(final InputStream in) { TikaContent tc = extractMetadata(in); if (tc == null) { return null; } Metadata metadata = tc.getMetadata(); SearchBean bean = new SearchBean(); for (final String property: metadata.names()) { bean.set(property, metadata.get(property)); } return bean; }
/** * Extract the metadata only from the input stream. Depending on media type validation, * the detector could be run against input stream in order to ensure that parser supports this * type of content. * @param in input stream to extract the metadata from * @return the extracted metadata converted to SearchBean or null if extraction is not possible * or was unsuccessful */ public SearchBean extractMetadataToSearchBean(final InputStream in) { TikaContent tc = extractMetadata(in); if (tc == null) { return null; } Metadata metadata = tc.getMetadata(); SearchBean bean = new SearchBean(); for (final String property: metadata.names()) { bean.set(property, metadata.get(property)); } return bean; }