Class DexFactory


  • public final class DexFactory
    extends java.lang.Object
    A factory class for loading dex files.

    Supported types: apk, zip, dex, odex, oat

    Available methods: Note: The Dexplore instances created by this class are thread-safe.
    Since:
    1.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      DexFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Dexplore load​(byte[] buffer)
      Loads a dex or odex file from memory.
      static Dexplore load​(byte[] buffer, DexOptions options)
      Loads a dex or odex file from memory.
      static Dexplore load​(java.lang.String path)
      Loads a file containing one or more dex files.
      static Dexplore load​(java.lang.String path, DexOptions options)
      Loads a file containing one or more dex files.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DexFactory

        public DexFactory()
    • Method Detail

      • load

        @Nonnull
        public static Dexplore load​(@Nonnull
                                    java.lang.String path)
        Loads a file containing one or more dex files.

        Note: The returned instance is thread-safe.


        See also: load(String, DexOptions)
        Parameters:
        path - the path of the file to open
        Returns:
        A Dexplore for the given file
        Throws:
        DexException - if something goes wrong
        FileNotFoundException - if the given file does not exist
        UnsupportedFileException - if the given file is not a valid dex file
      • load

        @Nonnull
        public static Dexplore load​(@Nonnull
                                    java.lang.String path,
                                    @Nonnull
                                    DexOptions options)
        Loads a file containing one or more dex files.

        Note: The returned instance is thread-safe.


        See also: load(String)
        Parameters:
        path - the path of the file to open
        options - a set of options to apply
        Returns:
        A Dexplore for the given file
        Throws:
        DexException - if something goes wrong
        FileNotFoundException - if the given file does not exist
        UnsupportedFileException - if the given file is not a valid dex file
      • load

        @Nonnull
        public static Dexplore load​(@Nonnull
                                    byte[] buffer)
        Loads a dex or odex file from memory.

        Note: The returned instance is thread-safe.


        See also: load(byte[], DexOptions)
        Parameters:
        buffer - a byte array containing the dex file
        Returns:
        A Dexplore instance for the given file
        Throws:
        UnsupportedFileException - if the given file is not a valid dex file
      • load

        @Nonnull
        public static Dexplore load​(@Nonnull
                                    byte[] buffer,
                                    @Nonnull
                                    DexOptions options)
        Loads a dex or odex file from memory.

        Note: The returned instance is thread-safe.


        See also: load(byte[])
        Parameters:
        buffer - a byte array containing the dex file
        options - a set of dex options to apply
        Returns:
        A Dexplore instance for the given file
        Throws:
        UnsupportedFileException - if the given file is not a valid dex file