I'm looking for magical Java class that will allow me to do something like this:
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
FileOutputStream fileStream = new FileOutputStream(new File("/tmp/somefile"));
MultiOutputStream outStream = new MultiOutputStream(byteStream, fileStream);
outStream.write("Hello world".getBytes());
Basically, I want tee
for OutputStream
s in Java. Any ideas?
Thanks!
question from:
https://stackoverflow.com/questions/7987395/how-to-write-data-to-two-java-io-outputstream-objects-at-once 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…