Package io.realm
Class DefaultCompactOnLaunchCallback
- java.lang.Object
-
- io.realm.DefaultCompactOnLaunchCallback
-
- All Implemented Interfaces:
CompactOnLaunchCallback
public class DefaultCompactOnLaunchCallback extends Object implements CompactOnLaunchCallback
The default implementation for determining if a file should be compacted or not. This implementation will only trigger if the file is above 50 MB and more than 50% can be reclaimed.
-
-
Constructor Summary
Constructors Constructor Description DefaultCompactOnLaunchCallback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldCompact(long totalBytes, long usedBytes)
This method determines if the Realm file should be compacted before opened and returned to the user.
-
-
-
Method Detail
-
shouldCompact
public boolean shouldCompact(long totalBytes, long usedBytes)
Description copied from interface:CompactOnLaunchCallback
This method determines if the Realm file should be compacted before opened and returned to the user. It is passed the total file size (data + free space) and the bytes used by data in the file.- Specified by:
shouldCompact
in interfaceCompactOnLaunchCallback
- Parameters:
totalBytes
- the total file size (data + free space).usedBytes
- the total bytes used by data in the file.- Returns:
- {code true} to indicate an attempt to compact the file should be made. Otherwise, the compaction will be skipped.
-
-