AdbDeviceConnection

public class AdbDeviceConnection
extends Object implements IDeviceConnection

java.lang.Object
   ↳ com.android.incfs.install.adb.ddmlib.AdbDeviceConnection


Represents a connection to a device through ADB for use with ERROR(/com.android.incfs.install.IncrementalInstallSession.Builder#execute(Executor,com.android.incfs.install.IDeviceConnection.Factory,ILogger)).

Summary

Nested classes

class AdbDeviceConnection.Factory

 

Public methods

void close()
static AdbDeviceConnection.Factory getFactory(String deviceSerialNumber)

Creates a factory for creating a connection to the device.

int read(ByteBuffer dst, long timeoutMs)

Reads a sequence of bytes from this connection into the given buffer.

int write(ByteBuffer src, long timeoutMs)

Writes a sequence of bytes to the device from the given buffer.

Public methods

close

public void close ()

getFactory

public static AdbDeviceConnection.Factory getFactory (String deviceSerialNumber)

Creates a factory for creating a connection to the device.

Parameters
deviceSerialNumber String: the serial of the device to talk to.

Returns
AdbDeviceConnection.Factory

read

public int read (ByteBuffer dst, 
                long timeoutMs)

Reads a sequence of bytes from this connection into the given buffer.

An attempt is made to read up to r bytes to the device, where r is the number of bytes remaining in the buffer, that is, dst.remaining(), at the moment this method is invoked.

Parameters
dst ByteBuffer: where to store data read from the socket

timeoutMs long: timeout in milliseconds (for the full operation to complete)

Returns
int The number of bytes read, possibly zero, or -1 if the command has ended.

write

public int write (ByteBuffer src, 
                long timeoutMs)

Writes a sequence of bytes to the device from the given buffer.

An attempt is made to write up to r bytes to the device, where r is the number of bytes remaining in the buffer, that is, src.remaining(), at the moment this method is invoked. It's

Parameters
src ByteBuffer: data to be sent

timeoutMs long: timeout in milliseconds (for the full operation to complete)

Returns
int The number of bytes written, possibly zero, or -1 if the command has ended.