/** * Handles a cancelled walk. * @param entry the entry that would be processed next * @throws IOException if the archive source could not be read. */ private void checkIfCancelled(T entry) throws IOException { if (isCancelled()) { throw new CancelException("Cancelled on entry [" + entry + "]"); } }
/** * Walks the Iterable archive. * @param iterable an iterable archive. * @throws IOException if the the archive source could not be read */ protected final void walk(Iterable<T> iterable) throws IOException { try { walkInternal(iterable); } catch (CancelException cancel) { handleCancelled(cancel); } }
@Override public final Iterator<TarArchiveEntry> iterator() { return new TarArchiveEntryIterator(in); } };
private void walkInternal(Iterable<T> archiveFile) throws IOException { for (T entry : archiveFile) { checkIfCancelled(entry); handleEntry(entry); } }
/** * Builds a URI for a zip file entry. * @param parent the parent zip file. * @param zipEntry the zip entry * @return the URI */ public static URI toZipUri(URI parent, String zipEntry) { return toUri(parent, zipEntry, ImageType.ZIP); }
@Override public final Iterator<ArcRecordBase> iterator() { return new ArcArchiveEntryIterator(arcIn); } };
@Override public int getSectorSize() throws IOException { ensureOpen(); return DEFAULT_SECTOR_SIZE; }
@Override public final Iterator<ZipEntry> iterator() { return new ZipFileIterator(zipFile); } };
@Override public long getFilePointer() throws IOException { ensureOpen(); return filePointer; }
@Override public final Iterator<WarcRecord> iterator() { return new WarcArchiveEntryIterator(arcIn); } };
@Override public Volume nextArchive(Archive archive, Volume lastVolume) throws IOException { // If the last volume is null, return a new volume. // If we already have a volume, since we don't support multi-volume rar's, just return null. return lastVolume == null ? new ReaderVolume(archive) : null; }
@Override public long getFilePointer() throws IOException { ensureOpen(); return filePointer; }
/** * Handles a cancelled walk. * @param entry the entry that would be processed next * @throws IOException if the archive source could not be read. */ private void checkIfCancelled(T entry) throws IOException { if (isCancelled()) { throw new CancelException("Cancelled on entry [" + entry + "]"); } }
/** * Walks the Iterable archive. * @param iterable an iterable archive. * @throws IOException if the the archive source could not be read */ protected final void walk(Iterable<T> iterable) throws IOException { try { walkInternal(iterable); } catch (CancelException cancel) { handleCancelled(cancel); } }
private void walkInternal(Iterable<T> archiveFile) throws IOException { for (T entry : archiveFile) { checkIfCancelled(entry); handleEntry(entry); } }
/** * Create URI for files inside ISO image. * @param parent URI of parent ISO file. eg: file://home/user/isofile.iso * @param imageEntry Full path of entry inside iso image eg: /dir/another dir/file.txt * @return URI. */ public static URI toIsoImageUri(URI parent, String imageEntry) { return toUri(parent, imageEntry, ImageType.ISO); }
@Override public final Iterator<ArcRecordBase> iterator() { return new ArcArchiveEntryIterator(arcIn); } };
@Override public void flush() throws IOException { ensureOpen(); // Nothing to flush for read only file systems. }
/** * Builds a URI for a tar file entry. * @param parent the parent tar file. * @param tarEntry the tar entry * @return the URI */ public static URI toTarUri(URI parent, String tarEntry) { return toUri(parent, tarEntry, ImageType.TAR); }
/** * Builds a URI for a 7z file entry. * @param parent the parent 7z file. * @param sevenZipEntry the 7z entry * @return the URI */ public static URI toSevenZUri(URI parent, String sevenZipEntry) { return toUri(parent, sevenZipEntry, ImageType.SEVENZ); }