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}로 설정하여 파일 압축을 시도해야 함을 나타냅니다. 그렇지 않으면 압축을 건너뜁니다.