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
ProgressListener
was 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 reporttrue
forisTransferComplete()
, and then on the next event reportfalse
.If the
ProgressListener
was 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 boolean
equals(Object o)
double
getFractionTransferred()
The fraction of bytes transferred out of all transferable bytes.long
getTransferableBytes()
Returns the total number of transferable bytes (bytes that have been transferred + bytes pending transfer).long
getTransferredBytes()
Returns the total number of bytes that has been transferred since theProgressListener
was added.int
hashCode()
boolean
isTransferComplete()
Returnstrue
when all pending bytes have been transferred.String
toString()
-
-
-
Method Detail
-
getTransferredBytes
public long getTransferredBytes()
Returns the total number of bytes that has been transferred since theProgressListener
was added.- Returns:
- the total number of bytes transferred since the
ProgressListener
was added.
-
getTransferableBytes
public long getTransferableBytes()
Returns the total number of transferable bytes (bytes that have been transferred + bytes pending transfer).If the
ProgressListener
is tracking downloads, this number represents the size of the changesets generated by all other clients using the Realm.If the
ProgressListener
is 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 theProgressListener
was added.- Returns:
- a number between
0.0
and1.0
, where0.0
represents that no data has been transferred yet, and1.0
that all data has been transferred.
-
isTransferComplete
public boolean isTransferComplete()
Returnstrue
when all pending bytes have been transferred.If the
ProgressListener
was registered withProgressMode.INDEFINITELY
, this method can returnfalse
for subsequent events after returningtrue
.If the
ProgressListener
was registered withProgressMode.CURRENT_CHANGES
, when this method returnstrue
, no more progress events will be sent.- Returns:
true
if all changes have been transferred,false
otherwise.
-
-