org.eclipse.ecf.filetransfer
Interface IFileRangeSpecification


public interface IFileRangeSpecification

An object that describes a file range specification. Object implementations of this class can be


Method Summary
 long getEndPosition()
          Get the end position of transfer range.
 long getStartPosition()
          Get the start position to start from.
 

Method Detail

getStartPosition

long getStartPosition()
Get the start position to start from. The position is in bytes, and byte 0 is the first byte of the file, N-1 is the last position in the file, where N is the length of the file in bytes.

Returns:
the position in the file (in bytes) to start from. If the returned start position is less than 0, or equal to or greater than N, then it is an invalid range specification and when used in IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(org.eclipse.ecf.filetransfer.identity.IFileID, IFileRangeSpecification, IFileTransferListener, java.util.Map) will result in a InvalidFileRangeSpecificationException.
See Also:
IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(org.eclipse.ecf.filetransfer.identity.IFileID, IFileRangeSpecification, IFileTransferListener, java.util.Map), getEndPosition()

getEndPosition

long getEndPosition()
Get the end position of transfer range. The position is in bytes, and byte 0 is the first byte of the file, N-1 is the last position in the file, where N is the length of the file in bytes.

Returns:
the position in the file (in bytes) to indicate the end of range to retrieve. If equal to -1, then this means that no end position is specified, and the download will continue to the end of file. If >= 0, but less than the getStartPosition() then this range specification is invalid. If greater than or equal to N (where N is length of the file in bytes), then the remaining part of the given file will be downloaded. If both getStartPosition() and getEndPosition() are valid, then the number of bytes downloaded will be (endPosition - startPosition) + 1. So, for example:
 For a fileLength = 20
 
 startPosition = 10
 endPosition = 19
 bytesDownloaded = 10
 
 startPosition = 0
 endPosition = -1
 bytesDownloaded = 20
 
 startPosition = 5
 endPosition = 3
 invalid range
 
 startPosition = 5
 endPosition = 6
 bytesDownloaded = 2
 
 startPosition = 5
 endPosition = -1
 bytesDownloaded = 15
 
 
See Also:
IRetrieveFileTransferContainerAdapter.sendRetrieveRequest(org.eclipse.ecf.filetransfer.identity.IFileID, IFileRangeSpecification, IFileTransferListener, java.util.Map), getStartPosition()