private static File tryToExtract( final Log logger, final ExtractDestination destination, final Archive arch, final FileHeader fileHeader ) throws IOException, RarException { final String fileNameString = fileHeader.getFileNameString(); if (fileHeader.isEncrypted()) { logger.warn("file is encrypted cannot extract: "+ fileNameString); return null; } logger.info("extracting: " + fileNameString); if (fileHeader.isDirectory()) { return destination.createDirectory(fileHeader); } else { return destination.extract(arch, fileHeader); } }
@Override public void print() { super.print(); StringBuilder str = new StringBuilder(); str.append("unpSize: " + getUnpSize()); str.append("\nHostOS: " + hostOS.name()); str.append("\nMDate: " + mTime); str.append("\nFileName: " + getFileNameString()); str.append("\nunpMethod: " + Integer.toHexString(getUnpMethod())); str.append("\nunpVersion: " + Integer.toHexString(getUnpVersion())); str.append("\nfullpackedsize: " + getFullPackSize()); str.append("\nfullunpackedsize: " + getFullUnpackSize()); str.append("\nisEncrypted: " + isEncrypted()); str.append("\nisfileHeader: " + isFileHeader()); str.append("\nisSolid: " + isSolid()); str.append("\nisSplitafter: " + isSplitAfter()); str.append("\nisSplitBefore:" + isSplitBefore()); str.append("\nunpSize: " + getUnpSize()); str.append("\ndataSize: " + getDataSize()); str.append("\nisUnicode: " + isUnicode()); str.append("\nhasVolumeNumber: " + hasVolumeNumber()); str.append("\nhasArchiveDataCRC: " + hasArchiveDataCRC()); str.append("\nhasSalt: " + hasSalt()); str.append("\nhasEncryptVersions: " + hasEncryptVersion()); str.append("\nisSubBlock: " + isSubBlock()); logger.info(str.toString()); }
@Override public void print() { super.print(); StringBuilder str = new StringBuilder(); str.append("unpSize: " + getUnpSize()); str.append("\nHostOS: " + hostOS.name()); str.append("\nMDate: " + mTime); str.append("\nFileName: " + getFileNameString()); str.append("\nunpMethod: " + Integer.toHexString(getUnpMethod())); str.append("\nunpVersion: " + Integer.toHexString(getUnpVersion())); str.append("\nfullpackedsize: " + getFullPackSize()); str.append("\nfullunpackedsize: " + getFullUnpackSize()); str.append("\nisEncrypted: " + isEncrypted()); str.append("\nisfileHeader: " + isFileHeader()); str.append("\nisSolid: " + isSolid()); str.append("\nisSplitafter: " + isSplitAfter()); str.append("\nisSplitBefore:" + isSplitBefore()); str.append("\nunpSize: " + getUnpSize()); str.append("\ndataSize: " + getDataSize()); str.append("\nisUnicode: " + isUnicode()); str.append("\nhasVolumeNumber: " + hasVolumeNumber()); str.append("\nhasArchiveDataCRC: " + hasArchiveDataCRC()); str.append("\nhasSalt: " + hasSalt()); str.append("\nhasEncryptVersions: " + hasEncryptVersion()); str.append("\nisSubBlock: " + isSubBlock()); logger.info(str.toString()); }
@Override protected void handleEntry(FileHeader entry) throws IOException { try { if (entry.isDirectory()) { String path = entry.getFileNameString(); if (!(path.endsWith(UNIX_PATH_SPLITTER) || path.endsWith(WINDOWS_PATH_SPLITTER))) { path += UNIX_PATH_SPLITTER; } submitDirectory(path, entry.getMTime()); } else if (entry.isEncrypted()) { throw new RuntimeException("Encrypted entry : " + entry.getFileNameString()); } else { submitFile(entry); } } catch (URISyntaxException ex) { throw new RuntimeException("Malformed uri for entry : " + entry.getFileNameString(), ex); } catch (RarException rarEx) { throw new RuntimeException("Probem with RAR extraction : " + entry.getFileNameString(), rarEx); } } }
@Override protected void handleEntry(FileHeader entry) throws IOException { try { if (entry.isDirectory()) { String path = entry.getFileNameString(); if (!(path.endsWith(UNIX_PATH_SPLITTER) || path.endsWith(WINDOWS_PATH_SPLITTER))) { path += UNIX_PATH_SPLITTER; } submitDirectory(path, entry.getMTime()); } else if (entry.isEncrypted()) { throw new RuntimeException("Encrypted entry : " + entry.getFileNameString()); } else { submitFile(entry); } } catch (URISyntaxException ex) { throw new RuntimeException("Malformed uri for entry : " + entry.getFileNameString(), ex); } catch (RarException rarEx) { throw new RuntimeException("Probem with RAR extraction : " + entry.getFileNameString(), rarEx); } } }