IDeviceConnection
public
interface
IDeviceConnection
implements
AutoCloseable
| com.android.incfs.install.IDeviceConnection |
代表可讀取及寫入的裝置連線。
摘要
巢狀類別 | |
|---|---|
interface |
IDeviceConnection.Factory
|
公用方法 | |
|---|---|
abstract
int
|
read(ByteBuffer buffer, long timeOutMs)
從這個連線讀取一連串位元組到指定的緩衝區。 |
abstract
int
|
write(ByteBuffer buffer, long timeOutMs)
從指定緩衝區將位元組序列寫入裝置。 |
公用方法
讀取
public abstract int read (ByteBuffer buffer,
long timeOutMs)從這個連線讀取一連串位元組到指定的緩衝區。
系統會嘗試從裝置讀取最多 r 個位元組,其中 r 是緩衝區中剩餘的位元組數,也就是叫用這個方法時的 dst.remaining()。
| 參數 | |
|---|---|
buffer |
ByteBuffer:從插座讀取資料時的儲存位置 |
timeOutMs |
long:逾時時間 (以毫秒為單位,表示完成完整作業所需的時間) |
| 傳回 | |
|---|---|
int |
讀取的位元組數 (可能為零),或指令已結束時為 -1。 |
| 擲回 | |
|---|---|
IOException |
|
另請參閱:
ERROR(java.nio.channels.Selector#select(long)}/{@link java.nio.channels.Selector#select(long)})ERROR(java.nio.channels.SocketChannel#read(java.nio.ByteBuffer) java.nio.channels.SocketChannel.read(ByteBuffer)}/{@link java.nio.channels.SocketChannel#read(java.nio.ByteBuffer) java.nio.channels.SocketChannel.read(ByteBuffer)})
寫入
public abstract int write (ByteBuffer buffer,
long timeOutMs)從指定緩衝區將位元組序列寫入裝置。
系統會嘗試將最多 r 個位元組寫入裝置,其中 r 是緩衝區中剩餘的位元組數,也就是叫用這個方法時的 src.remaining()。這是
| 參數 | |
|---|---|
buffer |
ByteBuffer:要傳送的資料 |
timeOutMs |
long:逾時時間 (以毫秒為單位,表示完成完整作業所需的時間) |
| 傳回 | |
|---|---|
int |
寫入的位元組數 (可能為零),或 -1 (如果指令已結束)。 |
| 擲回 | |
|---|---|
IOException |
|
另請參閱:
ERROR(java.nio.channels.Selector#select(long)}/{@link java.nio.channels.Selector#select(long)})ERROR(java.nio.channels.SocketChannel#write(java.nio.ByteBuffer) java.nio.channels.SocketChannel.write(ByteBuffer)}/{@link java.nio.channels.SocketChannel#write(java.nio.ByteBuffer) java.nio.channels.SocketChannel.write(ByteBuffer)})