java.io.EOFException:读取文件的 ZLIB 输入流意外结束 [英] java.io.EOFException: Unexpected end of ZLIB input stream reading a file

查看:115
本文介绍了java.io.EOFException:读取文件的 ZLIB 输入流意外结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了以下代码来读取 Freebase 数据转储,但出现错误 java.io.EOFException: Unexpected end of ZLIB input stream,我不知道该如何解决这个问题.你能告诉我问题出在哪里吗.

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

推荐答案

问题不在于这段代码,不管它的优点或缺点是什么.问题出在文件中.它被截断了:例如,可能没有正确下载.

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.

这篇关于java.io.EOFException:读取文件的 ZLIB 输入流意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆