src/AdbLib/doc/com/cgutman/adblib/AdbStream.html
com.cgutman.adblib
java.lang.Object
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
Constructors | Constructor and Description |
| --- |
| AdbStream(AdbConnection adbConn, int localId)
Creates a new AdbStream object on the specified AdbConnection with the given local ID.
|
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.
|
-
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
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
-
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
-
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
-
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
-
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.
-
public boolean isClosed()
Retreives whether the stream is closed or not Returns:True if the stream is close, false if not