问题
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