Java.util.zip. DataFormatException: invalid distance too far back, afaroffdistance
The following error occurs when extracting war/jar files:
Java.util.zip. ZipException: invalid distance too far back
At org.apache.commons.compress.archivers.zip. ZipArchiveInputStream. readFromInflater (ZipArchiveInputStream. java: 478)
At org.apache.commons.compress.archivers.zip. ZipArchiveInputStream. readDeflated (ZipArchiveInputStream. java: 443)
At org.apache.commons.compress.archivers.zip. ZipArchiveInputStream. read (ZipArchiveInputStream. java: 384)
At java. io. InputStream. read (Unknown Source)
At org. apache. commons. compress. utils. IOUtils. copy (IOUtils. java: 75)
At org. apache. commons. compress. utils. IOUtils. copy (IOUtils. java: 56)
At com. xunge. AESFileEncoder $ 1.run( AESFileEncoder. java: 149)
At java. lang. Thread. run (Unknown Source)
Caused by: java.util.zip. DataFormatException: invalid distance too far back
At java.util.zip. Inflater. inflateBytes (Native Method)
At java.util.zip. Inflater. inflate (Unknown Source)
At org.apache.commons.compress.archivers.zip. ZipArchiveInputStream. readFromInflater (ZipArchiveInputStream. java: 476)
... 7 more
Related code:
PipedInputStream pin = new PipedInputStream(); PipedOutputStream pout = new PipedOutputStream(pin); new Thread(new Runnable() { public void run() { try { IOUtils.copy(ais, pout); pout.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }).start(); ArchiveInputStream inJar = new ArchiveStreamFactory() .createArchiveInputStream(ArchiveStreamFactory.JAR, pin);
There is no problem with the above Code. If the code using the pin is separated by too many codes in the pin declaration code, this exception will occur. The specific failure to perform the test may also be the cause of the logic judgment statement.