@NotThreadSafe public class StreamCopier extends Object
InputStream to an OutputStream in a configurable way.| Modifier and Type | Class and Description |
|---|---|
static class |
StreamCopier.NotEnoughPermitsException
Indicates there were not enough permits in the
Limiter to finish the copy. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
| Constructor and Description |
|---|
StreamCopier(InputStream inputStream,
OutputStream outputStream) |
StreamCopier(InputStream inputStream,
OutputStream outputStream,
Long maxBytes) |
StreamCopier(ReadableByteChannel inputChannel,
WritableByteChannel outputChannel) |
StreamCopier(ReadableByteChannel inputChannel,
WritableByteChannel outputChannel,
Long maxBytes) |
| Modifier and Type | Method and Description |
|---|---|
StreamCopier |
closeChannelsOnComplete()
Close the input and output
Channels after copy, whether the copy was successful or not. |
long |
copy()
Execute the copy of bytes from the input to the output stream.
|
StreamCopier |
withBufferSize(int bufferSize)
Set the size in bytes of the buffer used to copy.
|
StreamCopier |
withCopySpeedMeter(Meter copySpeedMeter)
Set a
Meter where copy speed will be reported. |
public static final int DEFAULT_BUFFER_SIZE
public StreamCopier(InputStream inputStream, OutputStream outputStream)
public StreamCopier(InputStream inputStream, OutputStream outputStream, Long maxBytes)
public StreamCopier(ReadableByteChannel inputChannel, WritableByteChannel outputChannel)
public StreamCopier(ReadableByteChannel inputChannel, WritableByteChannel outputChannel, Long maxBytes)
public StreamCopier withBufferSize(int bufferSize)
public StreamCopier withCopySpeedMeter(Meter copySpeedMeter)
Meter where copy speed will be reported.public StreamCopier closeChannelsOnComplete()
Channels after copy, whether the copy was successful or not.public long copy()
throws IOException
IllegalStateException.IOException