/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(final File startDirectory, final Collection<T> results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(final CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(File startDirectory, Collection results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
@Override protected void handleCancelled( File startDirectory, Collection results, CancelException cancel) throws IOException { super.handleCancelled(startDirectory, results, cancel); // clean up objects and rollback transaction if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Stop requested when walking directory " + startDirectory); } super.handleEnd(results); }
/** * @see org.apache.commons.io.DirectoryWalker#handleEnd(java.util.Collection) */ @Override protected void handleEnd(Collection results) throws IOException { LOG.debug("ending process"); super.handleEnd(results); }
@Override protected void handleCancelled(File startDirectory, Collection results, CancelException cancel) throws IOException { super.handleCancelled(startDirectory, results, cancel); //clean up objects and rollback transaction if(LOGGER.isLoggable(Level.INFO)) LOGGER.info("Stop requested when walking directory "+startDirectory); super.handleEnd(results); }
@Override protected void handleEnd(final Collection<File> items) throws IOException { Archiver.this.archiveOutputStream.finish(); Archiver.this.archiveOutputStream.close(); super.handleEnd(items); }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(File startDirectory, Collection results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(final File startDirectory, final Collection<T> results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(final CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(File startDirectory, Collection<T> results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(File startDirectory, Collection results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(File startDirectory, Collection<T> results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }
/** * Internal method that walks the directory hierarchy in a depth-first manner. * <p> * Users of this class do not need to call this method. This method will * be called automatically by another (public) method on the specific subclass. * <p> * Writers of subclasses should call this method to start the directory walk. * Once called, this method will emit events as it walks the hierarchy. * The event methods have the prefix <code>handle</code>. * * @param startDirectory the directory to start from, not null * @param results the collection of result objects, may be updated * @throws NullPointerException if the start directory is null * @throws IOException if an I/O Error occurs */ protected final void walk(final File startDirectory, final Collection<T> results) throws IOException { if (startDirectory == null) { throw new NullPointerException("Start Directory is null"); } try { handleStart(startDirectory, results); walk(startDirectory, 0, results); handleEnd(results); } catch(final CancelException cancel) { handleCancelled(startDirectory, results, cancel); } }