Class Progress
- java.lang.Object
-
- io.realm.mongodb.sync.Progress
-
public class Progress extends Object
Class used to encapsulate progress notifications when either downloading or uploading Realm data. Each instance of this class is an immutable snapshot of the current progress.If the
ProgressListenerwas registered withProgressMode.INDEFINITELY, the progress reported bygetFractionTransferred()can both increase and decrease since more changes might be added while the progres listener is registered. This means it is possible for one notification to reporttrueforisTransferComplete(), and then on the next event reportfalse.If the
ProgressListenerwas registered withProgressMode.CURRENT_CHANGES, progress can only ever increase, and onceisTransferComplete()returnstrue, no further events will be generated.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)doublegetFractionTransferred()The fraction of bytes transferred out of all transferable bytes.longgetTransferableBytes()Returns the total number of transferable bytes (bytes that have been transferred + bytes pending transfer).longgetTransferredBytes()Returns the total number of bytes that has been transferred since theProgressListenerwas added.inthashCode()booleanisTransferComplete()Returnstruewhen all pending bytes have been transferred.StringtoString()
-
-
-
Method Detail
-
getTransferredBytes
public long getTransferredBytes()
Returns the total number of bytes that has been transferred since theProgressListenerwas added.- Returns:
- the total number of bytes transferred since the
ProgressListenerwas added.
-
getTransferableBytes
public long getTransferableBytes()
Returns the total number of transferable bytes (bytes that have been transferred + bytes pending transfer).If the
ProgressListeneris tracking downloads, this number represents the size of the changesets generated by all other clients using the Realm.If the
ProgressListeneris tracking uploads, this number represents the size of changesets created locally.- Returns:
- the total number of bytes that has been transferred + number of bytes still pending transfer.
-
getFractionTransferred
public double getFractionTransferred()
The fraction of bytes transferred out of all transferable bytes. Counting from since theProgressListenerwas added.- Returns:
- a number between
0.0and1.0, where0.0represents that no data has been transferred yet, and1.0that all data has been transferred.
-
isTransferComplete
public boolean isTransferComplete()
Returnstruewhen all pending bytes have been transferred.If the
ProgressListenerwas registered withProgressMode.INDEFINITELY, this method can returnfalsefor subsequent events after returningtrue.If the
ProgressListenerwas registered withProgressMode.CURRENT_CHANGES, when this method returnstrue, no more progress events will be sent.- Returns:
trueif all changes have been transferred,falseotherwise.
-
-