# How does Serial.readString() manage the serial buffer?

**URL:** <https://discourse.processing.org/t/how-does-serial-readstring-manage-the-serial-buffer/8206>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [February 8, 2019, 2:37am UTC](https://discourse.processing.org/t/how-does-serial-readstring-manage-the-serial-buffer/8206 "2019-02-08T02:37:04Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [February 8, 2019, 4:11am UTC](https://discourse.processing.org/t/how-does-serial-readstring-manage-the-serial-buffer/8206/5 "2019-02-08T04:11:32Z")

</div>

I am not sure if you are asking about how to use the available functions to read data immediately as it arrives or if you want to explore the details of the operation done by the Processing Serial library. If it is the second, you can always explore the source code available in [Github](https://github.com/processing/processing/blob/master/java/libraries/serial/src/processing/serial/Serial.java#L538). You can study the `SerialEvent()` as it shows how the handling of streaming data is done.

The part you will need to understand is mainly within the body of that specific function. However, before you go into this part of the source code, you need to understand [readStringUntil()](https://processing.org/reference/libraries/serial/Serial_readStringUntil_.html) as in when to use it and how to use it with the [available functions](https://processing.org/reference/libraries/serial/index.html).

A challenge for you, if you are interested, is to use a [Thread](https://en.wikipedia.org/wiki/Thread_(computing)) to simulate incoming serial data.

Kf

---

_[View the full topic](https://discourse.processing.org/t/how-does-serial-readstring-manage-the-serial-buffer/8206)._
