public class

RecoverKit

extends Object
java.lang.Object
   ↳ com.tencent.wcdb.repair.RecoverKit

Class Overview

Data recovery toolkit that recover data backed up by BackupKit.

Summary

Constants
int RESULT_CANCELED Result code that indicates operation has been cancelled.
int RESULT_FAILED Result code that indicates operation failure.
int RESULT_OK Result code that indicates successful operation.
Public Constructors
RecoverKit(SQLiteDatabase db, String inPath, byte[] key)
Create and initialize a recovery task.
Public Methods
void cancel()
Cancel the current running recovery operation.
int failureCount()
Retrieve total count of statements had been failed during the last time run(boolean) was called.
String lastError()
Get the last error message.
void release()
Cleanup and release this recovery task.
int run(boolean fatal)
Run recovery task.
int successCount()
Retrieve total count of successful statements had been run during the last time run(boolean) was called.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int RESULT_CANCELED

Result code that indicates operation has been cancelled.

Constant Value: 1 (0x00000001)

public static final int RESULT_FAILED

Result code that indicates operation failure.

Constant Value: -1 (0xffffffff)

public static final int RESULT_OK

Result code that indicates successful operation.

Constant Value: 0 (0x00000000)

Public Constructors

public RecoverKit (SQLiteDatabase db, String inPath, byte[] key)

Create and initialize a recovery task.

Parameters
db database where recovered data is written
inPath path to the backup file
key key to the encrypted backup file, or null for plain-text backup file.
Throws
SQLiteException when backup file cannot be opened.

Public Methods

public void cancel ()

Cancel the current running recovery operation.

This method can be called on threads other than the one called run(boolean) Calling this method causes run(boolean) to interrupt as quickly as possible and return RESULT_CANCELED

public int failureCount ()

Retrieve total count of statements had been failed during the last time run(boolean) was called.

Returns
  • count of failed statements

public String lastError ()

Get the last error message.

Returns
  • last error message, can be null.

public void release ()

Cleanup and release this recovery task. No further operations should be done on this object after calling it.

public int run (boolean fatal)

Run recovery task.

Note: this method will not return until recovery is finished or cancelled. Do not call this method directly on the main thread or it will probably cause ANR.

Parameters
fatal whether or not to treat errors as fatal. When it's true and an error occurs, recovery will end and return RESULT_CANCELED.
Returns

public int successCount ()

Retrieve total count of successful statements had been run during the last time run(boolean) was called.

Returns
  • count of successful statements