### Question:
TXTParser extends AbstractParser { @Override public String parse(File file, String filename, String encoding, Locale locale, String tenant) { FileInputStream fis = null; BufferedInputStream bis = null; try { fis = new FileInputStream(file); bis = new BufferedInputStream(fis); String enc = encoding; if (StringUtils.isEmpty(enc)) { try { CharsetDetector cd = new CharsetDetector(); cd.setText(bis); CharsetMatch cm = cd.detect(); if (cm != null) { if (Charset.isSupported(cm.getName())) enc = cm.getName(); } } catch (Throwable th) { log.warn("Error during TXT fileNameCharset detection", th); } } return parse(bis, filename, enc, locale, tenant); } catch (Throwable ex) { log.warn("Failed to extract TXT text content", ex); } finally { try { if (bis != null) bis.close(); if (fis != null) fis.close(); } catch (IOException e) { log.warn(e.getMessage(), e); } } return ""; }  @Override String parse(File file, String filename, String encoding, Locale locale, String tenant); @Override void internalParse(InputStream input, String filename, String encoding, Locale locale, String tenant,
			StringBuffer content);  }### Answer:
@Test public void testParse() throws UnsupportedEncodingException, FileNotFoundException { String inputFile = "src/test/resources/AnalyzeFileTest_enc.txt"; File file = new File(inputFile); String filename = file.getPath(); Parser parser = ParserFactory.getParser(filename); TXTParser p = (TXTParser) parser; String content = p.parse(file, filename, null, Locale.ENGLISH, Tenant.DEFAULT_NAME); Assert.assertTrue(content.contains("scalpo")); content = p.parse(new FileInputStream(inputFile), filename, null, Locale.ENGLISH, Tenant.DEFAULT_NAME); Assert.assertTrue(content.contains("scalpo")); }