com.atlassian.jira.util
Class StreamCopyingConsumer

java.lang.Object
  extended by com.atlassian.jira.util.StreamCopyingConsumer
All Implemented Interfaces:
Consumer<InputStream>

public class StreamCopyingConsumer
extends Object
implements Consumer<InputStream>

Copies an InputStream to the configured OutputStream. If there is an IOException during the copy, this will be thrown from the consume method inside a RuntimeException, but either way the


Constructor Summary
StreamCopyingConsumer(OutputStream outputStream, int bufferSize)
          Copies the consumed InputStream into the given OutputStream (without closing anything).
 
Method Summary
 void consume(InputStream inputStream)
          Consume the product.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamCopyingConsumer

public StreamCopyingConsumer(OutputStream outputStream,
                             int bufferSize)
Copies the consumed InputStream into the given OutputStream (without closing anything). If there is a problem copying, the IOException will be thrown wrapped in a RuntimeException.

Parameters:
outputStream - the OutputStream to copy to.
bufferSize - the desired number of bytes in the copy buffer.
Method Detail

consume

public void consume(@NotNull
                    InputStream inputStream)
Description copied from interface: Consumer
Consume the product.

Specified by:
consume in interface Consumer<InputStream>
Parameters:
inputStream - must not be null


Copyright © 2002-2012 Atlassian. All Rights Reserved.