IDeviceConnection

public interface IDeviceConnection

com.android.incfs.install.IDeviceConnection


Represents a connection to a device that can be read from and written to.

Summary

Nested classes

interface IDeviceConnection.Factory

 

Public methods

abstract int read(ByteBuffer buffer, long timeOutMs)

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

abstract int write(ByteBuffer buffer, long timeOutMs)

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

Public methods

read

public abstract int read (ByteBuffer buffer, 
                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
buffer 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 abstract int write (ByteBuffer buffer, 
                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
buffer 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.