java-使用管道流进行线程间通信

 使用管道流进行通信

以内存为媒介,用于线程之间的数据传输。

主要有面向字节:【PipedOutputStream、PipedInputStream】

面向字符【PipedReader、PipedWriter】

代码

读线程类:

 测试类

 结果:

 源代码地址:https://github.com/woxbwo/is-concurrent

 完成!!!

猜你喜欢

转载自www.cnblogs.com/woxbwo/p/11450766.html