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

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.ReaderTransferrer
All Implemented Interfaces:
Callable<Long>, Stoppable
Enclosing class:
StreamUtilImpl

protected class StreamUtilImpl.ReaderTransferrer
extends StreamUtilImpl.BaseTransferrer

This inner class is used to transfer a Reader to a Writer.


Field Summary
private  Writer destination
          The destination to write to.
private  boolean keepDestinationOpen
          true if destination should be closed.
private  Reader source
          The source to read from (to copy).
 
Constructor Summary
StreamUtilImpl.ReaderTransferrer(Reader source, Writer 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 Reader source
The source to read from (to copy).


destination

private final Writer destination
The destination to write to.


keepDestinationOpen

private final boolean keepDestinationOpen
true if destination should be closed.

Constructor Detail

StreamUtilImpl.ReaderTransferrer

public StreamUtilImpl.ReaderTransferrer(Reader source,
                                        Writer destination,
                                        boolean keepDestinationOpen,
                                        TransferCallback callback)
The constructor.

Parameters:
source - is Reader to read from.
destination - the Writer to write to.
keepDestinationOpen - true if the destination should be closed.
callback - is the callback or null.
See Also:
StreamUtilImpl.transfer(Reader, Writer, 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.