Package org.robolectric.shadows
Class ShadowDropBoxManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowDropBoxManager
-
@Implements(android.os.DropBoxManager.class) public class ShadowDropBoxManager extends Object
Fake dropbox manager that starts with no entries.
-
-
Constructor Summary
Constructors Constructor Description ShadowDropBoxManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addData(String tag, long wallTimestamp, byte[] data)
Adds entry to the DropboxManager with the flag indicating data is text.protected void
addText(String tag, String data)
Adds a text entry to dropbox with the current timestamp using UTF-8 encoding.protected DropBoxManager.Entry
getNextEntry(String tag, long millis)
void
reset()
Clears all entries.
-
-
-
Method Detail
-
addData
public void addData(String tag, long wallTimestamp, byte[] data)
Adds entry to the DropboxManager with the flag indicating data is text.The existing
DropBoxManager.addData(java.lang.String, byte[], int)
andDropBoxManager.addFile(java.lang.String, java.io.File, int)
methods in DropBoxManager are not shadowed (and do not work), butDropBoxManager.addText(java.lang.String, java.lang.String)
is. This method is a convenience for quickly adding multiple historical entries. The entries can be added in any order since this shadow will sort the entries by the specified timestamp.The flag will be set to
DropBoxManager.IS_TEXT
so thatDropBoxManager.Entry.getText(int)
can be used.- Parameters:
tag
- can be any arbitrary stringtimestamp
- a unique timestamp for the entry, relative toSystem.currentTimeMillis()
data
- must not be null
-
addText
@Implementation protected void addText(String tag, String data)
Adds a text entry to dropbox with the current timestamp using UTF-8 encoding.If adding multiple entries, it is required to ensure they have unique timestamps by bumping the wall-clock time, using
SystemClock
or similar.
-
reset
public void reset()
Clears all entries.
-
getNextEntry
@Implementation protected DropBoxManager.Entry getNextEntry(String tag, long millis)
-
-