Questions tagged «apache-tika»

5
从Zip文件中的文件读取内容
我正在尝试创建一个简单的Java程序,该程序从zip文件中的文件读取和提取内容。压缩文件包含3个文件(txt,pdf,docx)。我需要阅读所有这些文件的内容,并且为此使用了Apache Tika。 有人可以帮我实现此功能。到目前为止,我已经尝试过了,但是没有成功 程式码片段 public class SampleZipExtract { public static void main(String[] args) { List<String> tempString = new ArrayList<String>(); StringBuffer sbf = new StringBuffer(); File file = new File("C:\\Users\\xxx\\Desktop\\abc.zip"); InputStream input; try { input = new FileInputStream(file); ZipInputStream zip = new ZipInputStream(input); ZipEntry entry = zip.getNextEntry(); BodyContentHandler textHandler = new …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.