Merge "Add @TestApi annotations to CS-side RTT APIs for CTS"

This commit is contained in:
Hall Liu
2017-04-04 23:31:37 +00:00
committed by Gerrit Code Review
7 changed files with 92 additions and 22 deletions

View File

@ -1001,15 +1001,24 @@ public final class Call {
* @return A string containing text sent by the remote user, or {@code null} if the
* conversation has been terminated or if there was an error while reading.
*/
public String read() {
try {
int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
if (numRead < 0) {
return null;
}
return new String(mReadBuffer, 0, numRead);
} catch (IOException e) {
Log.w(this, "Exception encountered when reading from InputStreamReader: %s", e);
public String read() throws IOException {
int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
if (numRead < 0) {
return null;
}
return new String(mReadBuffer, 0, numRead);
}
/**
* Non-blocking version of {@link #read()}. Returns {@code null} if there is nothing to
* be read.
* @return A string containing text entered by the user, or {@code null} if the user has
* not entered any new text yet.
*/
public String readImmediately() throws IOException {
if (mReceiveStream.ready()) {
return read();
} else {
return null;
}
}