Class ShadowDropBoxManager


  • @Implements(android.os.DropBoxManager.class)
    public class ShadowDropBoxManager
    extends java.lang.Object
    Fake dropbox manager that starts with no entries.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addData​(java.lang.String tag, long wallTimestamp, byte[] data)
      Adds entry to the DropboxManager with the flag indicating data is text.
      protected void addText​(java.lang.String tag, java.lang.String data)
      Adds a text entry to dropbox with the current timestamp using UTF-8 encoding.
      protected android.os.DropBoxManager.Entry getNextEntry​(java.lang.String tag, long millis)  
      void reset()
      Clears all entries.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShadowDropBoxManager

        public ShadowDropBoxManager()
    • Method Detail

      • addData

        public void addData​(java.lang.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) and DropBoxManager.addFile(java.lang.String, java.io.File, int) methods in DropBoxManager are not shadowed (and do not work), but DropBoxManager.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 that DropBoxManager.Entry.getText(int) can be used.

        Parameters:
        tag - can be any arbitrary string
        timestamp - a unique timestamp for the entry, relative to System.currentTimeMillis()
        data - must not be null
      • addText

        @Implementation
        protected void addText​(java.lang.String tag,
                               java.lang.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 android.os.DropBoxManager.Entry getNextEntry​(java.lang.String tag,
                                                               long millis)