问题描述
Piped流的用例是什么?为什么不将数据读入缓冲区然后将其写出来?
使用Piped流的一个优点是它们在我们的代码中提供流功能,而不会迫使我们构建新的专用流。
例如我们可以使用管道为我们的应用程序创建简单的日志记录工具。我们可以通过普通的Printwritter向日志工具发送消息,然后它可以做任何处理或缓冲,然后再将消息发送到最终目的地。 / p>
更多详情请参阅:
What are use cases of Piped streams? Why just not read data into buffer and then write them out?
One advantage of using Piped streams is that they provide stream functionality in our code without compelling us to build new specialized streams.
For e.g. we can use pipes to create simple logging facility for our application.We can send messages to logging facility through ordinaty Printwritter and then it can do whatever processing or buffering is required before sending message off to final destination.
more details refer : http://docstore.mik.ua/orelly/java/exp/ch08_01.htm
这篇关于PipedInputStream和PipedOutputStream的用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!