public class FileToken {
private int filePosition;
- private int fileSize;
+ private long fileSize;
private String fileName;
private String path;
private void splitFileTokenInfo(String fileTokenInfo) {
String[] tokenPieces = fileTokenInfo.split(":");
this.filePosition = Integer.parseInt(tokenPieces[0]);
- this.fileSize = Integer.parseInt(tokenPieces[1]);
+ this.fileSize = Long.parseLong(tokenPieces[1]);
this.fileName = tokenPieces[2].replace(Characters.SPACE, " ");
}
return this.filePosition;
}
- public int getFileSize() {
+ public long getFileSize() {
return this.fileSize;
}
// values for tracking file output streams and matching data chunks with initial files
int currentDataChunkNumber;
int bytesDownloadedFromChunk;
- int bytesToDownload;
+ long bytesToDownload;
byte[] currentDataChunk;
boolean remainingDataInChunk;
final List<KeepLocator> keepLocators;
this.keepLocators = keepLocators;
}
- private int getBytesToDownload() {
+ private long getBytesToDownload() {
return bytesToDownload;
}
- private void setBytesToDownload(int bytesToDownload) {
+ private void setBytesToDownload(long bytesToDownload) {
this.bytesToDownload = bytesToDownload;
}
private void writeDownDataChunkPartially(FileOutputStream fos) throws IOException {
//write all remaining bytes for this file from current chunk
- fos.write(currentDataChunk, bytesDownloadedFromChunk, bytesToDownload);
+ fos.write(currentDataChunk, bytesDownloadedFromChunk, (int) bytesToDownload);
// update number of bytes downloaded from this chunk
bytesDownloadedFromChunk += bytesToDownload;
// set remaining data in chunk to true
public static final String FILE_TOKEN_INFO = "0:1024:test-file1";
public static final int FILE_POSITION = 0;
- public static final int FILE_LENGTH = 1024;
+ public static final long FILE_LENGTH = 1024L;
public static final String FILE_NAME = "test-file1";
public static final String FILE_PATH = "c" + Characters.SLASH;