javascalaunrar

Warning when upgrading junrar: Symbol extractArchive is deprecated


I'm using junrar 0.7 and am trying to upgrade to version 4.0.0, and in the process I am getting warnings about a certain method I am using to unrar a file to a destination directory. Here is my code (in Scala):

val rar = new File(archive)
val dest = new File(destination)
val extractArchive = new com.github.junrar.extract.ExtractArchive()
extractArchive.extractArchive(rar, dest)

However, my IntelliJ reports that extractArchive is now deprecated, and I'm wondering what is the correct way to do this now.


Solution

  • Here is the documentation for that deprecated method, which explains what you have to do:

         * @deprecated  As of release 1.0.2, replaced by { @link #Junrar.extract(final String rarPath, final String destinationPath) }
         *
         * @param archive rar file path
         * @param destination folder where the files will be extracted
         *
         * @throws IOException .
         * @throws RarException .
         */
        @Deprecated
        public void extractArchive(File archive, File destination) throws RarException, IOException {
            Junrar.extract(archive, destination);
        }
    

    So basically, your code should now look like this:

    val rar = new File(archive)
    val dest = new File(destination)
    Junrar.extract(rar, dest)