ParcelFileDescriptor.AutoCloseInputStream
public static class ParcelFileDescriptor.AutoCloseInputStream
extends FileInputStream
Known Direct Subclasses
|
您可以在ParcelFileDescriptor上创建一个InputStream,它将负责在流关闭时为您调用 ParcelFileDescriptor.close() 。
摘要(Summary)
公共方法(Public methods) |
void |
close() 关闭此文件输入流并释放与该流关联的所有系统资源。 |
int |
read() 从此输入流中读取一个字节的数据。 |
int |
read(byte[] b, int off, int len) 从此输入流读取多达 len个字节的数据字节数组。 |
int |
read(byte[] b) 从这个输入流中读取 b.length个字节的数据到一个字节数组中。 |
Public constructors
ParcelFileDescriptor.AutoCloseInputStream
ParcelFileDescriptor.AutoCloseInputStream (ParcelFileDescriptor pfd)
| 参数(Parameters) |
pfd |
ParcelFileDescriptor
|
公共方法(Public methods)
close
void close ()
关闭此文件输入流并释放与该流关联的所有系统资源。
如果此流具有关联的频道,那么该频道也会关闭。
read
int read ()
从此输入流中读取一个字节的数据。 如果没有输入可用,此方法会阻止。
| 返回(Returns) |
int |
the next byte of data, or -1 if the end of the file is reached. |
read
int read (byte[] b,
int off,
int len)
从这个输入流读取多达len字节的数据到一个字节数组中。 如果len不为零,则该方法阻塞,直到某些输入可用; 否则,不读取字节并返回0 。
| 参数(Parameters) |
b |
byte: the buffer into which the data is read. |
off |
int: the start offset in the destination array b |
len |
int: the maximum number of bytes read. |
| 返回(Returns) |
int |
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. |
read
int read (byte[] b)
从这个输入流中读取最多b.length个字节的数据到一个字节数组中。 此方法阻塞,直到有些输入可用。
| 参数(Parameters) |
b |
byte: the buffer into which the data is read. |
| 返回(Returns) |
int |
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. |