# Connection.RttTextStream

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# RttTextStream

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/telecom/Connection.RttTextStream "View this page in Java")  

```
class RttTextStream
```

|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                       ||
| ↳ | [android.telecom.Connection.RttTextStream](https://developer.android.com/reference/kotlin/android/telecom/Connection.RttTextStream#) |

Provides methods to read and write RTT data to/from the in-call app.

## Summary

|                                                                                                                                                                                       Public methods                                                                                                                                                                                        ||
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [read](https://developer.android.com/reference/kotlin/android/telecom/Connection.RttTextStream#read())`()` Reads a string from the in-call app, blocking if there is no data available.                                                                                                                  |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [readImmediately](https://developer.android.com/reference/kotlin/android/telecom/Connection.RttTextStream#readImmediately())`()` Non-blocking version of[read()](https://developer.android.com/reference/kotlin/android/telecom/Connection.RttTextStream#read()).                                        |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)      | [write](https://developer.android.com/reference/kotlin/android/telecom/Connection.RttTextStream#write(kotlin.String))`(`input:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Writes the string {@param input} into the text stream to the UI for this RTT call. |

## Public methods

### read

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun read(): String!
```

Reads a string from the in-call app, blocking if there is no data available. Returns`null`if the RTT conversation has been terminated and there is no further data to read.

This method is not thread-safe -- calling it from multiple threads simultaneously may lead to interleaved text.

|                                                                                                          Return                                                                                                          ||
|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | A string containing text entered by the user, or`null`if the conversation has been terminated or if there was an error while reading. |

### readImmediately

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun readImmediately(): String!
```

Non-blocking version of[read()](https://developer.android.com/reference/kotlin/android/telecom/Connection.RttTextStream#read()). Returns`null`if there is nothing to be read.

|                                                                                         Return                                                                                         ||
|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | A string containing text entered by the user, or`null`if the user has not entered any new text yet. |

### write

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun write(input: String!): Unit
```

Writes the string {@param input} into the text stream to the UI for this RTT call. Since RTT transmits text in real-time, this method should be called as often as text snippets are received from the remote user, even if it is only one character.

This method is not thread-safe -- calling it from multiple threads simultaneously may lead to interleaved text.

|                                                             Parameters                                                             ||
|---------|---------------------------------------------------------------------------------------------------------------------------|
| `input` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:The message to send to the in-call app. |