if(s.equalsIgnoreCase("rar")){
System.out.println(file.toString());
ReadOnlyAccessFile readFile = null;
try {
// readFile = new ReadOnlyAccessFile(file);
Archive arc = null;
try {
arc = new Archive(file);
} catch (RarException e) {
logger.error("archive consturctor error",e);
errorFiles.add(file.toString());
return;
}
if(arc != null){
if(arc.isEncrypted()){
logger.warn("archive is encrypted cannot extreact");
unsupportedFiles.add(file.toString());
return;
}
List<FileHeader> files = arc.getFileHeaders();
for(FileHeader fh : files)
{
if(fh.isEncrypted()){
logger.warn("file is encrypted cannot extract: "+fh.getFileNameString());
unsupportedFiles.add(file.toString());
return;
}
logger.info("extracting file: "+fh.getFileNameString());
if(fh.isFileHeader() && fh.isUnicode()){
logger.info("unicode name: "+fh.getFileNameW());
}
logger.info("start: "+new Date());
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
arc.extractFile(fh, os);
} catch (RarException e) {
if(e.getType().equals(RarExceptionType.notImplementedYet)){
logger.error("error extracting unsupported file: "+fh.getFileNameString(),e);
unsupportedFiles.add(file.toString());
return;