All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.mmm.util.io.TransferCallback Maven / Gradle / Ivy

The newest version!
/* $Id: TransferCallback.java 380 2007-12-17 13:32:37Z hohwille $
 * Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0 */
package net.sf.mmm.util.io;

/**
 * This is the callback interface used to receive the status of an async
 * transfer. Exactly one of the methods declared in this interface are called
 * when the transfer is done (successful or unsuccessful).
* ATTENTION:
* The according method of this callback will (typically) be invoked by a * different {@link Thread}. Please ensure that your implementation is * thread-safe. * * @see StreamUtil#transferAsync(java.io.InputStream, java.io.OutputStream, * boolean, TransferCallback) * * @author Joerg Hohwiller (hohwille at users.sourceforge.net) */ public interface TransferCallback { /** * This method is invoked if the transfer completed successfully. * * @param bytesTransferred is the number of bytes that have been transferred. */ void transferCompleted(long bytesTransferred); /** * This method is invoked if the transfer was stopped before it completed. * * @param bytesTransferred is the number of bytes that have been transferred * until the task has been stopped. */ void transferStopped(long bytesTransferred); /** * This method is invoked if the transfer failed because an exception * occurred. This will typically be an {@link java.io.IOException}. It may * also be a {@link RuntimeException}. * * @param e is the exception indicating the problem. */ void transferFailed(Exception e); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy