Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Class DefaultCompactOnLaunchCallback

On this page

  • io.realm
  • Constructors
  • Method Summary
  • Inherited Methods
  • Constructor Detail
  • Method Detail
  • shouldCompact
io.realm.DefaultCompactOnLaunchCallback

Implemented interfaces:

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 and Description
Modifier and Type
Method and Description
public boolean
long totalBytes,
long usedBytes
)

This method determines if the Realm file should be compacted before opened and returned to the user.

  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

public boolean shouldCompact (
long totalBytes,
long usedBytes
)

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.

Returns

{code true} to indicate an attempt to compact the file should be made. Otherwise, the compaction will be skipped.

← Interface CompactOnLaunchCallback