public void bytesReadRead(int count) { if (count > 0) { totalPackedRead += count; if (unrarCallback != null) { unrarCallback.volumeProgressChanged(totalPackedRead, totalPackedSize); } } }
public static boolean mergeArchive(Archive archive, ComprDataIO dataIO) throws IOException { FileHeader hd = dataIO.getSubHeader(); if (hd.getUnpVersion()>=20 && hd.getFileCRC()!=0xffffffff && dataIO.getPackedCRC()!=~hd.getFileCRC()) { System.err.println("Data Bad CRC"); } boolean oldNumbering = !archive.getMainHeader().isNewNumbering() || archive.isOldFormat(); String nextName = nextVolumeName(archive.getFile().getPath(), oldNumbering); NativeStorage nextVolume = archive.getFile().getParent().open(nextName); UnrarCallback callback = archive.getUnrarCallback(); if ((callback != null) && !callback.isNextVolumeReady(nextVolume)) { return false; } if (!nextVolume.exists()) { return false; } archive.setFile(nextVolume); hd = archive.nextFileHeader(); if (hd == null) { return false; } dataIO.init(hd); return true; }
void setFile(NativeStorage file) throws IOException { this.file = file; totalPackedSize = 0L; totalPackedRead = 0L; close(); rof =file.read(); try { readHeaders(); } catch (Exception e) { logger.log(Level.WARNING, "exception in archive constructor maybe file is encrypted " + "or currupt", e); // ignore exceptions to allow exraction of working files in // corrupt archive } // Calculate size of packed data for (BaseBlock block : headers) { if (block.getHeaderType() == UnrarHeadertype.FileHeader) { totalPackedSize += ((FileHeader) block).getFullPackSize(); } } if (unrarCallback != null) { unrarCallback.volumeProgressChanged(totalPackedRead, totalPackedSize); } }