0
click and see The NoPointerExcepeion왜 NoPointerExcepeion을 압축 해제 할 때 압축합니까?
나는 tar.gz의 파일을 생성하고이 다른 4 개 압축 해제를 보내지 만 자신의 progrem은 (자신의 progrem은 내가 작성되지 않았습니다), 하나의 파일이 해당 오류가 위의 오류가 있습니다.
하지만 내 컴퓨터 및 컴퓨터, 발생 아무 문제에 '타르 -xzvf ***'... 명령을 사용할 때 그래서 나는 2 아래에있는 내 progrem에서 잘못 알고 싶어 :public static void archive(ArrayList<File> files, File destFile) throws Exception {
TarArchiveOutputStream taos = new TarArchiveOutputStream(new FileOutputStream(destFile));
taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
for (File file : files) {
//LOG.info("file Name: "+file.getName());
archiveFile(file, taos, "");
}
}
private static void archiveFile(File file, TarArchiveOutputStream taos, String dir) throws Exception {
TarArchiveEntry entry = new TarArchiveEntry(dir + file.getName());
entry.setSize(file.length());
taos.putArchiveEntry(entry);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
int count;
byte data[] = new byte[BUFFER];
while ((count = bis.read(data, 0, BUFFER)) != -1) {
taos.write(data, 0, count);
}
bis.close();
taos.closeArchiveEntry();
}