net.sf.mmm.util.io.base
Class StreamUtilImpl.StreamTransferrer

java.lang.Object
  extended by net.sf.mmm.util.io.base.StreamUtilImpl.AbstractAsyncTransferrer
      extended by net.sf.mmm.util.io.base.StreamUtilImpl.BaseTransferrer
          extended by net.sf.mmm.util.io.base.StreamUtilImpl.StreamTransferrer
All Implemented Interfaces:
Callable<Long>, Stoppable
Enclosing class:
StreamUtilImpl

protected class StreamUtilImpl.StreamTransferrer
extends StreamUtilImpl.BaseTransferrer

This inner class is used to transfer an InputStream to an OutputStream.


Field Summary
private  OutputStream destination
          The destination to write to.
private  boolean keepDestinationOpen
          true if destination should be closed.
private  InputStream source
          The source to read from (to copy).
 
Constructor Summary
StreamUtilImpl.StreamTransferrer(InputStream source, OutputStream destination, boolean keepDestinationOpen, TransferCallback callback)
          The constructor.
 
Method Summary
 long transfer()
          This method performs the actual transfer.
 
Methods inherited from class net.sf.mmm.util.io.base.StreamUtilImpl.BaseTransferrer
call
 
Methods inherited from class net.sf.mmm.util.io.base.StreamUtilImpl.AbstractAsyncTransferrer
isCompleted, isStopped, setCompleted, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private final InputStream source
The source to read from (to copy).


destination

private final OutputStream destination
The destination to write to.


keepDestinationOpen

private final boolean keepDestinationOpen
true if destination should be closed.

Constructor Detail

StreamUtilImpl.StreamTransferrer

public StreamUtilImpl.StreamTransferrer(InputStream source,
                                        OutputStream destination,
                                        boolean keepDestinationOpen,
                                        TransferCallback callback)
The constructor.

Parameters:
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.
See Also:
StreamUtilImpl.transfer(InputStream, OutputStream, boolean)
Method Detail

transfer

public long transfer()
              throws IOException
This method performs the actual transfer.

Specified by:
transfer in class StreamUtilImpl.BaseTransferrer
Returns:
the number of bytes that have been transferred.
Throws:
IOException - if the transfer failed.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.