/** * Returns the first <code>ArchiveFormatProvider</code> that matches the specified filename, <code>null</code> * if there is none. Note that if a filename matches the {@link java.io.FilenameFilter} of several registered * providers, the first provider matching the filename will be returned. * * @param filename an archive filename that potentially matches one of the registered <code>ArchiveFormatProvider</code> * @return the first <code>ArchiveFormatProvider</code> that matches the specified filename, <code>null</code> if there is none */ public static ArchiveFormatProvider getArchiveFormatProvider(String filename) { if(filename == null) return null; for (ArchiveFormatProvider provider : archiveFormatProviders) { if (provider.getFilenameFilter().accept(filename)) return provider; } return null; }