protected class StreamUtilImpl.StreamTransferrer extends StreamUtilImpl.BaseTransferrer<byte[]>
InputStream
to an OutputStream
.Modifier and Type | Field and Description |
---|---|
private OutputStream |
destination
The destination to write to.
|
private InputStream |
source
The source to read from (to copy).
|
Constructor and Description |
---|
StreamTransferrer(InputStream source,
OutputStream destination,
boolean keepDestinationOpen,
TransferCallback callback)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected OutputStream |
getDestination()
This method gets the destination to transfer to.
|
protected Pool<byte[]> |
getPool()
This method gets the
Pool to retrieve buffers. |
protected InputStream |
getSource()
This method gets the source to transfer.
|
long |
transfer(byte[] buffer)
This method performs the actual transfer.
|
call, transfer
isCompleted, isStopped, setCompleted, stop
private final InputStream source
private final OutputStream destination
public StreamTransferrer(InputStream source, OutputStream destination, boolean keepDestinationOpen, TransferCallback callback)
source
- is InputStream
to read from.destination
- the OutputStream
to write to.keepDestinationOpen
- true
if the destination
should be closed.callback
- is the callback or null
.StreamUtilImpl.transfer(InputStream, OutputStream, boolean)
protected InputStream getSource()
StreamUtilImpl.BaseTransferrer
getSource
in class StreamUtilImpl.BaseTransferrer<byte[]>
InputStream
or Reader
).protected OutputStream getDestination()
StreamUtilImpl.BaseTransferrer
getDestination
in class StreamUtilImpl.BaseTransferrer<byte[]>
OutputStream
or Writer
).protected Pool<byte[]> getPool()
StreamUtilImpl.BaseTransferrer
Pool
to retrieve buffers.getPool
in class StreamUtilImpl.BaseTransferrer<byte[]>
Pool
.public long transfer(byte[] buffer) throws IOException
StreamUtilImpl.BaseTransferrer
transfer
in class StreamUtilImpl.BaseTransferrer<byte[]>
buffer
- is the buffer used for the transfer.IOException
- if the transfer failed.Copyright © 2001–2016 mmm-Team. All rights reserved.