public class AdbConnection
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Method and Description |
---|---|
void |
close()
This routine closes the Adb connection and underlying socket
|
void |
connect()
Connects to the remote device.
|
static AdbConnection |
create(java.net.Socket socket,
AdbCrypto crypto)
Creates a AdbConnection object associated with the socket and
crypto object specified.
|
int |
getMaxData()
Gets the max data size that the remote client supports.
|
AdbStream |
open(java.lang.String destination)
Opens an AdbStream object corresponding to the specified destination.
|
public static AdbConnection create(java.net.Socket socket, AdbCrypto crypto) throws java.io.IOException
socket
- The socket that the connection will use for communcation.crypto
- The crypto object that stores the key pair for authentication.java.io.IOException
- If there is a socket errorpublic int getMaxData() throws java.lang.InterruptedException, java.io.IOException
java.lang.InterruptedException
- If a connection cannot be waited on.java.io.IOException
- if the connection failspublic void connect() throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
- If the socket fails while connectingjava.lang.InterruptedException
- If we are unable to wait for the connection to finishpublic AdbStream open(java.lang.String destination) throws java.io.UnsupportedEncodingException, java.io.IOException, java.lang.InterruptedException
destination
- The destination to open on the targetjava.io.UnsupportedEncodingException
- If the destination cannot be encoded to UTF-8java.io.IOException
- If the stream fails while sending the packetjava.lang.InterruptedException
- If we are unable to wait for the connection to finishpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- if the socket fails to close