Better alternative for PipedReader/PipedWriter?

后端 未结 4 1528
难免孤独
难免孤独 2021-02-09 00:01

I need to have a buffered char stream, into which I write in one thread and from which I read in another thread. Right now I\'m using PipedReader and PipedWriter fo

4条回答
  •  长情又很酷
    2021-02-09 00:42

    It should be fairly easy to wrap a char stream API around BlockingQueue.

    I must say, however, it seems quite perverse that PipedReader would use polling to wait for data. Is this documented somewhere, or did you discover it for yourself somehow?

提交回复
热议问题