Package 

Class NameSpace


  • 
    public final class NameSpace
    
                        

    a facade wraps custom root directory

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String rootDir
    • Method Summary

      Modifier and Type Method Description
      String getRootDir()
      MMKV mmkvWithID(String mmapID) Create an MMKV instance with an unique ID (in single-process mode).
      MMKV mmkvWithID(String mmapID, int mode) Create an MMKV instance in single-process or multi-process mode.
      MMKV mmkvWithID(String mmapID, int mode, long expectedCapacity) Create an MMKV instance in single-process or multi-process mode.
      MMKV mmkvWithID(String mmapID, int mode, @Nullable() String cryptKey) Create an MMKV instance in customize process mode, with an encryption key.
      MMKV mmkvWithID(String mmapID, int mode, @Nullable() String cryptKey, long expectedCapacity) Create an MMKV instance with customize settings all in one.
      boolean backupOneToDirectory(String mmapID, String dstDir) backup one MMKV instance to dstDir
      boolean restoreOneMMKVFromDirectory(String mmapID, String srcDir) restore one MMKV instance from srcDir
      boolean isFileValid(String mmapID) Check whether the MMKV file is valid or not.Note: Don't use this to check the existence of the instance, the result is undefined on nonexistent files.
      boolean removeStorage(String mmapID) remove the storage of the MMKV, including the data file & meta file (.
      boolean checkExist(String mmapID) check existence of the MMKV file
      • Methods inherited from class java.lang.Object

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

      • mmkvWithID

        @NonNull() MMKV mmkvWithID(String mmapID)

        Create an MMKV instance with an unique ID (in single-process mode).

        Parameters:
        mmapID - The unique ID of the MMKV instance.
      • mmkvWithID

        @NonNull() MMKV mmkvWithID(String mmapID, int mode)

        Create an MMKV instance in single-process or multi-process mode.

        Parameters:
        mmapID - The unique ID of the MMKV instance.
        mode - The process mode of the MMKV instance, defaults to SINGLE_PROCESS_MODE.
      • mmkvWithID

        @NonNull() MMKV mmkvWithID(String mmapID, int mode, long expectedCapacity)

        Create an MMKV instance in single-process or multi-process mode.

        Parameters:
        mmapID - The unique ID of the MMKV instance.
        mode - The process mode of the MMKV instance, defaults to SINGLE_PROCESS_MODE.
        expectedCapacity - The file size you expected when opening or creating file
      • mmkvWithID

        @NonNull() MMKV mmkvWithID(String mmapID, int mode, @Nullable() String cryptKey)

        Create an MMKV instance in customize process mode, with an encryption key.

        Parameters:
        mmapID - The unique ID of the MMKV instance.
        mode - The process mode of the MMKV instance, defaults to SINGLE_PROCESS_MODE.
        cryptKey - The encryption key of the MMKV instance (no more than 16 bytes).
      • mmkvWithID

        @NonNull() MMKV mmkvWithID(String mmapID, int mode, @Nullable() String cryptKey, long expectedCapacity)

        Create an MMKV instance with customize settings all in one.

        Parameters:
        mmapID - The unique ID of the MMKV instance.
        mode - The process mode of the MMKV instance, defaults to SINGLE_PROCESS_MODE.
        cryptKey - The encryption key of the MMKV instance (no more than 16 bytes).
        expectedCapacity - The file size you expected when opening or creating file
      • backupOneToDirectory

         boolean backupOneToDirectory(String mmapID, String dstDir)

        backup one MMKV instance to dstDir

        Parameters:
        mmapID - the MMKV ID to backup
        dstDir - the backup destination directory
      • restoreOneMMKVFromDirectory

         boolean restoreOneMMKVFromDirectory(String mmapID, String srcDir)

        restore one MMKV instance from srcDir

        Parameters:
        mmapID - the MMKV ID to restore
        srcDir - the restore source directory
      • isFileValid

         boolean isFileValid(String mmapID)

        Check whether the MMKV file is valid or not.Note: Don't use this to check the existence of the instance, the result is undefined on nonexistent files.

      • removeStorage

         boolean removeStorage(String mmapID)

        remove the storage of the MMKV, including the data file & meta file (.crc)Note: the existing instance (if any) will be closed & destroyed

        Parameters:
        mmapID - The unique ID of the MMKV instance.
      • checkExist

         boolean checkExist(String mmapID)

        check existence of the MMKV file

        Parameters:
        mmapID - The unique ID of the MMKV instance.