ISArchiveParser implements Parser { @Override public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { TemporaryResources tmp = TikaInputStream.isTikaInputStream(stream) ? null : new TemporaryResources(); TikaInputStream tis = TikaInputStream.get(stream, tmp); try { if (this.location == null) { this.location = tis.getFile().getParent() + File.separator; } this.studyFileName = tis.getFile().getName(); File locationFile = new File(location); String[] investigationList = locationFile.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.matches("i_.+\\.txt"); } }); XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata); xhtml.startDocument(); parseInvestigation(investigationList, xhtml, metadata, context); parseStudy(stream, xhtml, metadata, context); parseAssay(xhtml, metadata, context); xhtml.endDocument(); } finally { if (tmp != null) { tmp.dispose(); } } } ISArchiveParser();  ISArchiveParser(String location); @Override Set<MediaType> getSupportedTypes(ParseContext context); @Override void parse(InputStream stream, ContentHandler handler, Metadata metadata,
			ParseContext context);  }
@Test public void testParseArchive() throws Exception { String path = "/test-documents/testISATab_BII-I-1/s_BII-S-1.txt"; Parser parser = new ISArchiveParser(ISArchiveParserTest.class.getResource("/test-documents/testISATab_BII-I-1/").toURI().getPath()); ContentHandler handler = new BodyContentHandler(); Metadata metadata = new Metadata(); ParseContext context = new ParseContext(); try (InputStream stream = ISArchiveParserTest.class.getResourceAsStream(path)) { parser.parse(stream, handler, metadata, context); } assertEquals("Invalid Investigation Identifier", "BII-I-1", metadata.get("Investigation Identifier")); assertEquals("Invalid Investigation Title", "Growth control of the eukaryote cell: a systems biology study in yeast", metadata.get("Investigation Title")); assertEquals("Invalid Investigation PubMed ID", "17439666", metadata.get("Investigation PubMed ID")); assertEquals("Invalid Investigation Publication DOI", "doi:10.1186/jbiol54", metadata.get("Investigation Publication DOI")); assertEquals("Invalid Investigation Person Last Name", "Oliver", metadata.get("Investigation Person Last Name")); assertEquals("Invalid Investigation Person First Name", "Stephen", metadata.get("Investigation Person First Name")); }