org.mpisws.p2p.filetransfer
Class TempFileAllocationStrategy
java.lang.Object
org.mpisws.p2p.filetransfer.TempFileAllocationStrategy
- All Implemented Interfaces:
- FileAllocationStrategy
public class TempFileAllocationStrategy
- extends Object
- implements FileAllocationStrategy
Just creates a temp file, ignoring the filename/size. Does not delete on exit, as this is not memory safe.
- Author:
- Jeff Hoye
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
prefix
protected String prefix
suffix
protected String suffix
dir
protected File dir
TempFileAllocationStrategy
public TempFileAllocationStrategy()
TempFileAllocationStrategy
public TempFileAllocationStrategy(String prefix,
String suffix)
TempFileAllocationStrategy
public TempFileAllocationStrategy(String prefix,
String suffix,
File directory)
getFile
public File getFile(ByteBuffer metadata,
long offset,
long length)
throws IOException
- Specified by:
getFile in interface FileAllocationStrategy
- Parameters:
metadata - application specific, often the file name
- Returns:
-
- Throws:
IOException
fileCancelled
public void fileCancelled(ByteBuffer metadata,
File f,
long offset,
long downloadedLength,
long requestedLength,
Exception reason)
- Description copied from interface:
FileAllocationStrategy
- Notification of a cancelled transfer.
- Specified by:
fileCancelled in interface FileAllocationStrategy
- Parameters:
metadata - application specific, often the file namef - the file that was given by this strategy beforeoffset - the beginning point in the file of this file transferdownloadedLength - the actual "valid" downloaded lengthrequestedLength - the length of the original file transfer request
Copyright © 2010. All Rights Reserved.