Class BackupDataEntity

java.lang.Object
org.robolectric.shadows.BackupDataEntity

public abstract class BackupDataEntity extends Object
Represents a key value pair in ShadowBackupDataInput and ShadowBackupDataOutput.
  • Constructor Details

    • BackupDataEntity

      public BackupDataEntity()
  • Method Details

    • key

      public abstract String key()
      The header key for a backup entity.
    • dataSize

      public abstract int dataSize()
      The size of data in a backup entity.
    • data

      public abstract byte[] data()
      The byte array of data in a backup entity.
    • createDeletedEntity

      public static BackupDataEntity createDeletedEntity(String key)
      Constructs a new entity with the given key but a negative size. This represents a deleted pair.
    • create

      public static BackupDataEntity create(String key, String data)
      Constructs a pair with a string value. The value will be converted to a byte array in StandardCharsets.UTF_8.
    • create

      public static BackupDataEntity create(String key, byte[] data)
      Constructs a new entity where the size of the value is the entire array.
    • create

      public static BackupDataEntity create(String key, byte[] data, int dataSize)
      Constructs a new entity.
      Parameters:
      key - the key of the pair
      data - the value to associate with the key
      dataSize - the length of the value in bytes