@Test public void testParseGlobalMetadata() throws Exception { if(System.getProperty("java.version").startsWith("1.5")) { return; } Parser parser = new HDFParser(); ContentHandler handler = new BodyContentHandler(); Metadata metadata = new Metadata(); try (InputStream stream = HDFParser.class.getResourceAsStream("/test-documents/test.he5")) { parser.parse(stream, handler, metadata, new ParseContext()); } assertNotNull(metadata); assertEquals("5", metadata.get("GranuleMonth")); }
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copy(stream, os); String name = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY); if (name == null) { name = ""; } try { NetcdfFile ncFile = NetcdfFile.openInMemory(name, os.toByteArray()); unravelStringMet(ncFile, null, metadata); } catch (IOException e) { throw new TikaException("HDF parse error", e); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }
HDFParser extends AbstractParser { public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copy(stream, os); String name = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY); if (name == null) { name = ""; } try { NetcdfFile ncFile = NetcdfFile.openInMemory(name, os.toByteArray()); unravelStringMet(ncFile, null, metadata); } catch (IOException e) { throw new TikaException("HDF parse error", e); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); } }
HDFParser extends AbstractParser { public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copy(stream, os); String name = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY); if (name == null) { name = ""; } try { NetcdfFile ncFile = NetcdfFile.openInMemory(name, os.toByteArray()); unravelStringMet(ncFile, null, metadata); } catch (IOException e) { throw new TikaException("HDF parse error", e); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }  }
HDFParser extends AbstractParser { public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copy(stream, os); String name = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY); if (name == null) { name = ""; } try { NetcdfFile ncFile = NetcdfFile.openInMemory(name, os.toByteArray()); unravelStringMet(ncFile, null, metadata); } catch (IOException e) { throw new TikaException("HDF parse error", e); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }  Set<MediaType> getSupportedTypes(ParseContext context); void parse(InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context); }
HDFParser extends AbstractParser { public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copy(stream, os); String name = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY); if (name == null) { name = ""; } try { NetcdfFile ncFile = NetcdfFile.openInMemory(name, os.toByteArray()); unravelStringMet(ncFile, null, metadata); } catch (IOException e) { throw new TikaException("HDF parse error", e); } XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); xhtml.endDocument(); }  Set<MediaType> getSupportedTypes(ParseContext context); void parse(InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context);  }