Closeable, AutoCloseablepublic abstract class Resource extends InputStream
Resource instances can be obtained only using the
ResourceManager.getResource(int) method.
ResourceManager,
ResourceType| 构造器 | 说明 |
|---|---|
Resource() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
abstract int |
available() |
Obtains the total number of bytes that can be read from the resource.
|
abstract void |
close() |
Closes this resource and releases any system resources associated with the stream.
|
int |
read() |
Reads the next byte from the resource.
|
abstract int |
read(byte[] bytes,
int off,
int len) |
Reads up to
len bytes from the resource. |
mark, markSupported, read, reset, skippublic abstract int available()
throws IOException
available 在类中 InputStreamIOException - Throws this exception if an I/O error occurs.public abstract int read(byte[] bytes,
int off,
int len)
throws IOException,
IndexOutOfBoundsException,
NullPointerException
len bytes from the resource.read 在类中 InputStreambytes - Indicates the buffer into which the data is read.off - Indicates the start offset in array bytes at which the data is written.len - Indicates the maximum number of bytes to read.-1 if
there is no more data because the end of the stream has been reached.IOException - Throws this exception if an I/O error occurs.NullPointerException - Throws this exception if array bytes is null.IndexOutOfBoundsException - Throws this exception if off is negative,
len is negative, or len is greater
than bytes.length - off.InputStream.read(byte[], int, int)public int read()
throws IOException
read 在类中 InputStream-1 if the end of the stream
has been reached.IOException - Throws this exception if an I/O error occurs.public abstract void close()
throws IOException
close 在接口中 AutoCloseableclose 在接口中 Closeableclose 在类中 InputStreamIOException - Throws this exception if an I/O error occurs.