简体   繁体   English

java.io.EOFException:ZLIB 输入流意外结束

[英]java.io.EOFException: Unexpected end of ZLIB input stream

Testing my tar.gz extraction tool, I found thrown the exception:测试我的 tar.gz 提取工具,我发现抛出了异常:

java.io.EOFException: Unexpected end of ZLIB input stream
    at java.util.zip.InflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.util.zip.GZIPInputStream.read(Unknown Source)
    at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
    at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
    at sun.nio.cs.StreamDecoder.read(Unknown Source)
    at java.io.InputStreamReader.read(Unknown Source)
    at java.io.BufferedReader.fill(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at it.uniroma2.informatica.specialistica.IO.ScanCompressedFileUtil.main(ScanCompressedFileUtil.java:60

So the code at line 60 is:所以第 60 行的代码是:

BufferedReader bufLe= reader.remove();
try {
  while ( bufLe.ready() ){
    System.out.println(" "+bufLe.readLine());
  }
} catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
}

where calling buffer.readLine() , throws the exception.其中调用buffer.readLine() ,抛出异常。 When I open the tar.gz, I kept the stream of all single file, like BuffReader then I put them to a linkedList, and then i Closed the buffer of the file tar.gz opened.当我打开 tar.gz 时,我保留了所有单个文件的流,比如 BuffReader 然后我把它们放到一个链表中,然后我关闭了打开的文件 tar.gz 的缓冲区。

But When I pop an element within the linked list and then try to read line by line, I have the execption.但是当我在链表中​​弹出一个元素然后尝试逐行读取时,我得到了执行。

Why do I have this exception?为什么我有这个例外? Maybe I am wrong somethinh when I iterate through the files within the tar.gz?当我遍历 tar.gz 中的文件时,也许我错了?

To doing so, I have the code:为此,我有代码:

TarInputStream is =  new TarInputStream(gzipInputStream);

TarEntry entryx = null;

try {
  while((entryx = is.getNextEntry()) != null) {
    InputStream tmpInx = new StreamingTarEntry(is,  entryx.getSize());
    // questo viene invocato perchè il file da lettere è un file txt
    manageTxtinsideTAR(tmpInx , buffer);
    // I add the stream to a linked list

THe class STREAMINGTARENTRY, extends FilterInputStream, so it's only wraps the stream. STREAMINGTARENTRY 类扩展了 FilterInputStream,因此它只包装流。

It could be related to the JVM bug http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=53ede10dc8803210b03577eac43?bug_id=6519463它可能与 JVM 错误有关http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=53ede10dc8803210b03577eac43?bug_id=6519463

See my answer for more details on this related question https://stackoverflow.com/a/18845169/2463453有关此相关问题的更多详细信息,请参阅我的回答https://stackoverflow.com/a/18845169/2463453

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.EOFException:ZLIB 输入 stream 的意外结束 - java.io.EOFException: Unexpected end of ZLIB input stream during reading stream data java.io.EOFException:读取gzip编码网站的ZLIB输入流意外结束 - java.io.EOFException: Unexpected end of ZLIB input stream reading gzip encoded website java.io.EOFException:ZLIB输入流的意外结尾读取文件 - java.io.EOFException: Unexpected end of ZLIB input stream reading a file java.io.EOFException:ZLIB 输入 stream 的意外结束 - java.io.EOFException: Unexpected end of ZLIB input stream - reading from HTTP java.io.EOFException:在try-with-resources中使用ByteArrayOutputStream时ZLIB输入流的意外结束 - java.io.EOFException: Unexpected end of ZLIB input stream when using ByteArrayOutputStream in try-with-resources java.io.EOFException:使用 Apache POI 的 ZLIB 输入流意外结束 - java.io.EOFException: Unexpected end of ZLIB input stream using Apache POI 在使用ImageIO.read()时如何弃用'java.io.EOFException:ZLIB输入流的意外结束' - How to soleve 'java.io.EOFException: Unexpected end of ZLIB input stream' while use ImageIO.read() Java调用因未捕获的Java异常而终止:java.lang.RuntimeException:java.io.EOFException:ZLIB输入流的意外结束 - Java call terminated by uncaught Java exception: java.lang.RuntimeException: java.io.EOFException: Unexpected end of ZLIB input stream EOFException:ZLIB 输入流意外结束 - EOFException: Unexpected end of ZLIB input stream TwelveMonkeys 3.1.1:PSD文件ImageIO.read给出java.io.EOFException:PackBits流的意外结束 - TwelveMonkeys 3.1.1: PSD file ImageIO.read gives java.io.EOFException: Unexpected end of PackBits stream
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM