Back to Solopi

AdbConnection

src/AdbLib/doc/com/cgutman/adblib/AdbConnection.html

0.12.05.2 KB
Original Source

com.cgutman.adblib

Class AdbConnection

  • java.lang.Object

    • com.cgutman.adblib.AdbConnection
  • All Implemented Interfaces:java.io.Closeable, java.lang.AutoCloseable


public classAdbConnectionextends java.lang.Object
implements java.io.Closeable

This class represents an ADB connection. Author:Cameron Gutman

Method Summary

Methods | 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. |

- 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

- 

create

public static[AdbConnection](../../../com/cgutman/adblib/AdbConnection.html "class in com.cgutman.adblib")create(java.net.Socket socket,[AdbCrypto](../../../com/cgutman/adblib/AdbCrypto.html "class in com.cgutman.adblib")crypto)
                            throws java.io.IOException

Creates a AdbConnection object associated with the socket and crypto object specified. Parameters:socket - The socket that the connection will use for communcation.crypto - The crypto object that stores the key pair for authentication.Returns:A new AdbConnection object.Throws:java.io.IOException - If there is a socket error

- 

getMaxData

public int getMaxData()
               throws java.lang.InterruptedException,
                      java.io.IOException

Gets the max data size that the remote client supports. A connection must have been attempted before calling this routine. This routine will block if a connection is in progress. Returns:The maximum data size indicated in the connect packet.Throws:java.lang.InterruptedException - If a connection cannot be waited on.java.io.IOException - if the connection fails

- 

connect

public void connect()
             throws java.io.IOException,
                    java.lang.InterruptedException

Connects to the remote device. This routine will block until the connection completes. Throws:java.io.IOException - If the socket fails while connectingjava.lang.InterruptedException - If we are unable to wait for the connection to finish

- 

open

public[AdbStream](../../../com/cgutman/adblib/AdbStream.html "class in com.cgutman.adblib")open(java.lang.String destination)
               throws java.io.UnsupportedEncodingException,
                      java.io.IOException,
                      java.lang.InterruptedException

Opens an AdbStream object corresponding to the specified destination. This routine will block until the connection completes. Parameters:destination - The destination to open on the targetReturns:AdbStream object corresponding to the specified destinationThrows:java.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 finish

- 

close

public void close()
           throws java.io.IOException

This routine closes the Adb connection and underlying socket Specified by: close in interface java.io.Closeable Specified by: close in interface java.lang.AutoCloseableThrows:java.io.IOException - if the socket fails to close