org.mpisws.p2p.filetransfer
Interface FileAllocationStrategy

All Known Implementing Classes:
TempFileAllocationStrategy

public interface FileAllocationStrategy

Tells FileTransfer where to store the bytes of a file, usually a temp file.

Author:
Jeff Hoye

Method Summary
 void fileCancelled(ByteBuffer metadata, File f, long offset, long downloadedLength, long requestedLength, Exception reason)
          Notification of a cancelled transfer.
 File getFile(ByteBuffer metadata, long offset, long length)
           
 

Method Detail

getFile

File getFile(ByteBuffer metadata,
             long offset,
             long length)
             throws IOException
Parameters:
metadata - application specific, often the file name
size - the total file size
start - the first byte intended to transfer
finish - the last byte intended to transfer
Returns:
Throws:
IOException

fileCancelled

void fileCancelled(ByteBuffer metadata,
                   File f,
                   long offset,
                   long downloadedLength,
                   long requestedLength,
                   Exception reason)
Notification of a cancelled transfer.

Parameters:
metadata - application specific, often the file name
f - the file that was given by this strategy before
offset - the beginning point in the file of this file transfer
downloadedLength - the actual "valid" downloaded length
requestedLength - the length of the original file transfer request


Copyright © 2010. All Rights Reserved.