Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

BackupDataInputStream

extends InputStream
java.lang.Object
   ↳ java.io.InputStream
     ↳ android.app.backup.BackupDataInputStream

Class Overview

Provides an InputStream -like interface for accessing an entity's data during a restore operation. Used by BackupHelper classes within the BackupAgentHelper mechanism.

When BackupHelper.restoreEntity() is called, the current entity's header has already been read from the underlying BackupDataInput . The entity's key string and total data size are available through this class's getKey() and size() methods, respectively.

Note: The caller should take care not to seek or close the underlying data source, nor read more than size() bytes from the stream.

Summary

Public Methods
String getKey ()
Report the key string associated with this entity within the backup data set.
int read (byte[] b)
Read enough entity data into a byte array to fill the array.
int read ()
Read one byte of entity data from the stream, returning it as an integer value.
int read (byte[] b, int offset, int size)
Read up to size bytes of data into a byte array, beginning at position offset within the array.
int size ()
Report the total number of bytes of data available for the current entity.
[Expand]
Inherited Methods
From class java.io.InputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Public Methods

public String getKey ()

Added in API level 8

Report the key string associated with this entity within the backup data set.

Returns

public int read (byte[] b)

Added in API level 8

Read enough entity data into a byte array to fill the array.

Parameters
b Byte array to fill with data from the stream. If the stream does not have sufficient data to fill the array, then the contents of the remainder of the array will be undefined.
Returns
  • The number of bytes of data read, or zero if all of the entity's data has already been read.

public int read ()

Added in API level 8

Read one byte of entity data from the stream, returning it as an integer value. If more than size() bytes of data are read from the stream, the output of this method is undefined.

Returns
  • The byte read, or undefined if the end of the stream has been reached.

public int read (byte[] b, int offset, int size)

Added in API level 8

Read up to size bytes of data into a byte array, beginning at position offset within the array.

Parameters
b Byte array into which the data will be read
offset The data will be stored in b beginning at this index within the array.
size The number of bytes to read in this operation. If insufficient data exists within the entity to fulfill this request, only as much data will be read as is available.
Returns
  • The number of bytes of data read, or zero if all of the entity's data has already been read.

public int size ()

Added in API level 8

Report the total number of bytes of data available for the current entity.

Returns