BackupDataInputStreampublic class BackupDataInputStream extends InputStream Provides an {@link java.io.InputStream}-like interface for accessing an
entity's data during a restore operation. Used by {@link BackupHelper} classes within the {@link
BackupAgentHelper} mechanism.
When {@link BackupHelper#restoreEntity(BackupDataInputStream) BackupHelper.restoreEntity()}
is called, the current entity's header has already been read from the underlying
{@link BackupDataInput}. The entity's key string and total data size are available
through this class's {@link #getKey()} and {@link #size()} methods, respectively.
Note: The caller should take care not to seek or close the underlying data
source, nor read more than {@link #size()} bytes from the stream. |
Fields Summary |
---|
String | key | int | dataSize | BackupDataInput | mData | byte[] | mOneByte |
Constructors Summary |
---|
BackupDataInputStream(BackupDataInput data)
mData = data;
|
Methods Summary |
---|
public java.lang.String | getKey()Report the key string associated with this entity within the backup data set.
return this.key;
| public int | read()Read one byte of entity data from the stream, returning it as
an integer value. If more than {@link #size()} bytes of data
are read from the stream, the output of this method is undefined.
byte[] one = mOneByte;
if (mOneByte == null) {
one = mOneByte = new byte[1];
}
mData.readEntityData(one, 0, 1);
return one[0];
| public int | read(byte[] b, int offset, int size)Read up to {@code size} bytes of data into a byte array, beginning at position
{@code offset} within the array.
return mData.readEntityData(b, offset, size);
| public int | read(byte[] b)Read enough entity data into a byte array to fill the array.
return mData.readEntityData(b, 0, b.length);
| public int | size()Report the total number of bytes of data available for the current entity.
return this.dataSize;
|
|