有一个简单的“三通”过滤器Java流? [英] Is there a simple “tee” filter for Java streams?
问题描述
有关调试效果影响不大,我想转储输出流的内容到一个文件,而对其进行处理。流由 org.xml.sax.XMLReader中
解析,这将comsume数据。
For debugging purpouses I would like to dump the content of an output stream into a file while it is processed. The stream is parsed by org.xml.sax.XMLReader
which will comsume the data.
我会GESS人需要一个过滤器,归档此,写我的一个自我之前,我想问问,如果有一个现成的版本,媒体链接。
I would gess one need a filter to archive this and before writing one my self I wanted to ask if there is a ready made version allready.
更新:
如果HABE提到,我的工作在Android上。
Should habe mentioned that I work on Android.
我有什么:
final org.apache.http.HttpEntity responseEntity = response.getEntity ();
final java.io.InputStream content = responseEntity.getContent ();
final java.io.InputStreamReader contentReader =
new java.io.InputStreamReader (content, "UTF-8");
所以,我有一个的java.io.InputStream
和 InputStreamReader的
。
推荐答案
不是很现成推出,但是的这可能会感兴趣。有在实施例中一个TeeOutputStream实施
Not quite a ready rolled one, but this might be of interest. There is a TeeOutputStream implementation in the examples.
这篇关于有一个简单的“三通”过滤器Java流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!