Class ComparableBackup
-
- All Implemented Interfaces:
-
org.signal.libsignal.internal.NativeHandleGuard.Owner
public class ComparableBackup extends NativeHandleGuard.SimpleOwner
An in-memory representation of a backup file used to compare contents.
When comparing the contents of two backups:
- Create a `ComparableBackup` instance for each of the inputs.
- Check the `unknownFields()` value; if it's not empty, some parts of the backup weren't parsed and won't be compared.
- Produce a canonical string for each backup with `comparableString()`.
-
-
Method Summary
Modifier and Type Method Description static ComparableBackupreadUnencrypted(MessageBackup.Purpose purpose, InputStream input, long streamLength)Reads an unencrypted message backup bundle into memory for comparison. StringgetComparableString()Produces a string representation of the contents. Array<String>getUnknownFieldMessages()Returns the unrecognized protobuf fields present in the backup. -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.SimpleOwner
unsafeNativeHandleWithoutGuard -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.Owner
guard, guardedMap, guardedMapChecked, guardedRun, guardedRunChecked -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
readUnencrypted
static ComparableBackup readUnencrypted(MessageBackup.Purpose purpose, InputStream input, long streamLength)
Reads an unencrypted message backup bundle into memory for comparison.
Returns an error if the input cannot be read or if validation fails.
- Parameters:
purpose- whether the input was created for device-to-device transfer or remote backupinput- anInputStreamthat produces the inputstreamLength- the number of bytes eachInputStreamwill produce
-
getComparableString
String getComparableString()
Produces a string representation of the contents.
The returned strings for two backups will be equal if the backups contain the same logical content. If two backups' strings are not equal, the diff will show what is different between them.
- Returns:
a canonical string representation of the backup
-
getUnknownFieldMessages
Array<String> getUnknownFieldMessages()
Returns the unrecognized protobuf fields present in the backup.
If the returned array is not empty, some parts of the backup were not recognized and won't be present in the string representation.
- Returns:
information about each unknown field found in the backup
-
-
-
-