@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, metadata);
        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((dir, name) -> 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();
            }
        }
    }
@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());
        //Parser parser = new AutoDetectParser();

        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);
        }

        // INVESTIGATION
        assertEquals("BII-I-1", metadata.get("Investigation Identifier"),
                "Invalid Investigation Identifier");
        assertEquals("Growth control of the eukaryote cell: a systems biology study in yeast",
                metadata.get("Investigation Title"),
                "Invalid Investigation Title");

        // INVESTIGATION PUBLICATIONS
        assertEquals("17439666", metadata.get("Investigation PubMed ID"),
                "Invalid Investigation PubMed ID");
        assertEquals("doi:10.1186/jbiol54",
                metadata.get("Investigation Publication DOI"),
                "Invalid Investigation Publication DOI");

        // INVESTIGATION CONTACTS
        assertEquals( "Oliver", metadata.get("Investigation Person Last Name"),
                "Invalid Investigation Person Last Name");
        assertEquals("Stephen", metadata.get("Investigation Person First Name"),
                "Invalid Investigation Person First Name");
    }