public Extractor newExtractor ( Path archive , Path destination , ProgressListener progressListener ) throws UnknownArchiveTypeException { if ( archive . toString ( ) . toLowerCase ( ) . endsWith ( ".tar.gz" ) ) { return new Extractor ( archive , destination , new TarGzExtractorProvider ( ) , progressListener ) ; } if ( archive . toString ( ) . toLowerCase ( ) . endsWith ( ".zip" ) ) { return new Extractor ( archive , destination , new ZipExtractorProvider ( ) , progressListener ) ; } throw new UnknownArchiveTypeException ( archive ) ; }
Creates a new extractor based on filetype . Filetype determination is based on the filename string this method makes no attempt to validate the file contents to verify they are the type defined by the file extension .