Back to Solopi

AdbStream

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

0.12.05.2 KB
Original Source

com.cgutman.adblib

Class AdbStream

  • java.lang.Object

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


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

This class abstracts the underlying ADB streams Author:Cameron Gutman

Constructor Summary

Constructors | Constructor and Description | | --- | | AdbStream(AdbConnection adbConn, int localId) Creates a new AdbStream object on the specified AdbConnection with the given local ID. |

Method Summary

Methods | Modifier and Type | Method and Description | | --- | --- | | void | close() Closes the stream. | | boolean | isClosed() Retreives whether the stream is closed or not | | byte[] | read() Reads a pending write payload from the other side. | | void | write(byte[] payload) Sends a write packet with a given byte array payload. | | void | write(byte[] payload, boolean flush) Queues a write packet and optionally sends it immediately. | | void | write(java.lang.String payload) Sends a write packet with a given String payload. |

- 

Methods inherited from class java.lang.Object

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

Constructor Detail

- 

AdbStream

public AdbStream([AdbConnection](../../../com/cgutman/adblib/AdbConnection.html "class in com.cgutman.adblib")adbConn,
         int localId)

Creates a new AdbStream object on the specified AdbConnection with the given local ID. Parameters:adbConn - AdbConnection that this stream is running onlocalId - Local ID of the stream

Method Detail

- 

read

public byte[] read()
            throws java.lang.InterruptedException,
                   java.io.IOException

Reads a pending write payload from the other side. Returns:Byte array containing the payload of the writeThrows:java.lang.InterruptedException - If we are unable to wait for datajava.io.IOException - If the stream fails while waiting

- 

write

public void write(java.lang.String payload)
           throws java.io.IOException,
                  java.lang.InterruptedException

Sends a write packet with a given String payload. Parameters:payload - Payload in the form of a StringThrows:java.io.IOException - If the stream fails while sending datajava.lang.InterruptedException - If we are unable to wait to send data

- 

write

public void write(byte[] payload)
           throws java.io.IOException,
                  java.lang.InterruptedException

Sends a write packet with a given byte array payload. Parameters:payload - Payload in the form of a byte arrayThrows:java.io.IOException - If the stream fails while sending datajava.lang.InterruptedException - If we are unable to wait to send data

- 

write

public void write(byte[] payload,
         boolean flush)
           throws java.io.IOException,
                  java.lang.InterruptedException

Queues a write packet and optionally sends it immediately. Parameters:payload - Payload in the form of a byte arrayflush - Specifies whether to send the packet immediatelyThrows:java.io.IOException - If the stream fails while sending datajava.lang.InterruptedException - If we are unable to wait to send data

- 

close

public void close()
           throws java.io.IOException

Closes the stream. This sends a close message to the peer. Specified by: close in interface java.io.Closeable Specified by: close in interface java.lang.AutoCloseableThrows:java.io.IOException - If the stream fails while sending the close message.

- 

isClosed

public boolean isClosed()

Retreives whether the stream is closed or not Returns:True if the stream is close, false if not