summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/Call.java
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android/telecom/Call.java')
-rw-r--r--telecomm/java/android/telecom/Call.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index f80ee7386f99..b4414d5b6168 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -1009,15 +1009,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;
}
}