public class BackupDataInputStream extends InputStream
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.
BackupAgentHelper
,
BackupHelper
Modifier and Type | Method and Description |
---|---|
String |
getKey()
Report the key string associated with this entity within the backup data set.
|
int |
read()
Read one byte of entity data from the stream, returning it as
an integer value.
|
int |
read(byte[] b)
Read enough entity data into a byte array to fill the array.
|
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.
|
available, close, mark, markSupported, reset, skip
public int read() throws IOException
size()
bytes of data
are read from the stream, the output of this method is undefined.read
in class InputStream
IOException
- if an I/O error occurs.public int read(byte[] b, int offset, int size) throws IOException
size
bytes of data into a byte array, beginning at position
offset
within the array.read
in class InputStream
b
- Byte array into which the data will be readoffset
- 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.IOException
- If the first byte cannot be read for any reason
other than end of file, or if the input stream has been closed, or if
some other I/O error occurs.InputStream.read()
public int read(byte[] b) throws IOException
read
in class InputStream
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.IOException
- If the first byte cannot be read for any reason
other than the end of the file, if the input stream has been closed, or
if some other I/O error occurs.InputStream.read(byte[], int, int)
public String getKey()
BackupDataInput.getKey()
on the underlying BackupDataInput
.public int size()
BackupDataInput.getDataSize()
on the underlying BackupDataInput
.