IDeviceConnection

public interface IDeviceConnection

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。

写内容

public abstract int write (ByteBuffer buffer, 
                long timeOutMs)

将给定缓冲区中的一系列字节写入设备。

尝试向设备写入最多 r 个字节,其中 r 是调用此方法时缓冲区中剩余的字节数,即 src.remaining()。这是

参数
buffer ByteBuffer:要发送的数据

timeOutMs long:超时时间(以毫秒为单位,用于完成整个操作)

返回
int 写入的字节数(可能为零),如果命令已结束,则为 -1。