java.io.EOFException: Unexpected end of ZLIB input stream reading a file

不打扰是莪最后的温柔 提交于 2019-12-10 12:09:02

问题


I wrote the following code to read Freebase data dumps and I got error java.io.EOFException: Unexpected end of ZLIB input stream and I do not know how should I solve this problem. Could you please tell me where is the problem.

 GZIPInputStream in = new GZIPInputStream(new FileInputStream(path.freebaseTriples));

 String line;
 Reader decoder = new InputStreamReader(in);
 BufferedReader br = new BufferedReader(decoder);
 ParseFreebaseRDF rdfs= new ParseFreebaseRDF();

 while ((line = br.readLine()) != null) {
     rdfs.parser(line);
 }

 br.close();
 decoder.close();
 in.close();

回答1:


The problem is not in this code, whatever its merits or demerits may be. The problem is in the file. It is truncated: possibly not downloaded correctly, for example.



来源:https://stackoverflow.com/questions/28129419/java-io-eofexception-unexpected-end-of-zlib-input-stream-reading-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!