Docs Menu

Interface CompactOnLaunchCallback

This interface is used to determine if a Realm file should be compacted the first time the file is opened and before the instance is returned.Note that compacting a file can take a while, so compacting should generally only be done on a background thread or when used in combination with Realm.getInstanceAsync(RealmConfiguration, io.realm.Realm.Callback) .

修飾子と型
メソッドと説明

パブリックブール値

long totalBytes,
long usedBytes
)

このメソッドは、Realm ファイルを開いてユーザーに返す前に圧縮する必要があるかどうかを決定します。

public boolean shouldCompact (
long totalBytes,
long usedBytes
)

このメソッドは、Realm ファイルを開いてユーザーに返す前に圧縮する必要があるかどうかを決定します。 合計ファイルサイズ(データ + 空き領域)とファイル内のデータによって使用されるバイト数が渡されます。

パラメーター

  • totalBytes - the total file size (data + free space).

  • usedBytes - the total bytes used by data in the file.

戻り値

{code true} は、ファイルを圧縮する試行を実行する必要があることを示します。 それ以外の場合、圧縮はスキップされます。