본문 바로가기
💻Tech/☕Java

[Java] TarArchiveInputStream error detected parsing the header

by _viper_ 2016. 7. 11.
반응형

🚫 ERROR

java.io.IOException: Error detected parsing the header

FileInputStream fin = null;
BufferedInputStream bis = null;
GzipCompressorInputStream gzIn = null;
TarArchiveInputStream tarIn = null;
InputStreamReader is = null;
BufferedReader br = null;

fin = new FileInputStream();                
bis = new BufferedInputStream(fin);
tarIn = new TarArchiveInputStream(bis);
is = new InputStreamReader(tarIn, "UTF-8");
br = new BufferedReader(is);
ArchiveEntry entry = null;

while ((entry = tarIn.getNextEntry()) != null) {                                
    if (entry.isDirectory()) {
    } else {
    }
}

  

💡 SOLVED

FileInputStream fin = null;
BufferedInputStream bis = null;
GzipCompressorInputStream gzIn = null;
TarArchiveInputStream tarIn = null;
InputStreamReader is = null;
BufferedReader br = null;

fin = new FileInputStream();                
bis = new BufferedInputStream(fin);
gzIn = new GzipCompressorInputStream(bis); //추가
tarIn = new TarArchiveInputStream(gzIn);   //변경
is = new InputStreamReader(tarIn, "UTF-8");
br = new BufferedReader(is);
ArchiveEntry entry = null;

while ((entry = tarIn.getNextEntry()) != null) {                                
    if (entry.isDirectory()) {
    } else {
    }
}