/** * Recursively adds contents from the referenced directory to an existing * collection. Directories are excluded from the result. Supported protocols * include {@code file} and {@code jar}. * * @param result The collection to which contents should be added. * @param directory The directory whose contents should be listed. * @return A collection of {@link URL}s representing the directory's contents. * @see #appendContents(Collection, URL, boolean, boolean) */ public static Collection<URL> appendContents(final Collection<URL> result, final URL directory) { return appendContents(result, directory, true, true); }
/** * Recursively adds contents from the referenced directory to an existing * collection. Directories are excluded from the result. Supported protocols * include {@code file} and {@code jar}. * * @param result The collection to which contents should be added. * @param directory The directory whose contents should be listed. * @return A collection of {@link URL}s representing the directory's contents. * @see #appendContents(Collection, URL, boolean, boolean) */ public static Collection<URL> appendContents(final Collection<URL> result, final URL directory) { return appendContents(result, directory, true, true); }
/** * Lists all contents of the referenced directory. Supported protocols include * {@code file} and {@code jar}. * * @param directory The directory whose contents should be listed. * @param recurse Whether to list contents recursively, as opposed to only the * directory's direct contents. * @param filesOnly Whether to exclude directories in the resulting collection * of contents. * @return A collection of {@link URL}s representing the directory's contents. */ public static Collection<URL> listContents(final URL directory, final boolean recurse, final boolean filesOnly) { return appendContents(new ArrayList<URL>(), directory, recurse, filesOnly); }
/** * Lists all contents of the referenced directory. Supported protocols include * {@code file} and {@code jar}. * * @param directory The directory whose contents should be listed. * @param recurse Whether to list contents recursively, as opposed to only the * directory's direct contents. * @param filesOnly Whether to exclude directories in the resulting collection * of contents. * @return A collection of {@link URL}s representing the directory's contents. */ public static Collection<URL> listContents(final URL directory, final boolean recurse, final boolean filesOnly) { return appendContents(new ArrayList<URL>(), directory, recurse, filesOnly); }
appendContents(result, file.toURI().toURL(), recurse, filesOnly);
appendContents(result, file.toURI().toURL(), recurse, filesOnly);