package com.vci.client.volumn;
|
|
/**
|
* <p>Title: </p>
|
* <p>Description: 记录文件传输过程中的一些参数</p>
|
* <p>Copyright: Copyright (c) 2011</p>
|
* <p>Company: VCI</p>
|
* @author Administrator
|
* @time 2011-7-3
|
* @version 1.0
|
*/
|
public class TransFileInfo {
|
|
private static long totalSendedSize = 0;//已经发送了多少字节.
|
private static Object synObject1 = new Object();
|
|
private static long totalSendedTime = 0;//发送花了多少时间 单位为毫秒.
|
private static Object synObject2 = new Object();
|
|
private static long totalReceivedSize = 0;//已经接收了多少字节.
|
private static Object synObject3 = new Object();
|
|
private static long totalReceivedTime = 0;//接收花了多少时间 单位为毫秒.
|
private static Object synObject4 = new Object();
|
|
private static long totalFileNum = 0;//总文件数
|
private static long currentFileNum = 0;//当前传输的第多少个文件
|
private static String filePath = "";//文件路径
|
private static long fileLength = 0;//文件长度
|
|
public static void setFileLength(long length){
|
fileLength = length;
|
}
|
|
public static long getFileLength(){
|
return fileLength;
|
}
|
|
public static void setFilePath(String path){
|
filePath = path;
|
}
|
|
public static String getFilePath(){
|
return filePath;
|
}
|
|
public static void setTotalFileNum(long fileNum) {
|
totalFileNum = fileNum;
|
}
|
|
public static long getTotalFileNum() {
|
return totalFileNum;
|
}
|
|
public static void startCurrentFileTrans() {
|
currentFileNum ++;
|
if(currentFileNum >= totalFileNum){
|
currentFileNum = totalFileNum;
|
}
|
}
|
|
public static void setCurrentFileTrans(long curNum){
|
currentFileNum = curNum;
|
}
|
|
public static long getCurrentFileNum() {
|
return currentFileNum;
|
}
|
public static void setTotalReceivedTime(long receivedTime) {
|
synchronized (synObject4) {
|
totalReceivedTime += receivedTime;
|
}
|
}
|
|
public static long getTotalReceivedTime() {
|
synchronized (synObject4) {
|
return totalReceivedTime;
|
}
|
}
|
|
public static void setTotalReceivedSize(long receivedSize) {
|
synchronized (synObject3) {
|
totalReceivedSize += receivedSize;
|
}
|
}
|
|
public static long getTotalReceivedSize() {
|
synchronized (synObject3) {
|
return totalReceivedSize;
|
}
|
}
|
|
public static void setTotalSendedSize(long sendedSize) {
|
synchronized (synObject1) {
|
totalSendedSize += sendedSize;
|
}
|
}
|
|
public static long getTotalSendedSize() {
|
synchronized (synObject1) {
|
return totalSendedSize;
|
}
|
}
|
|
public static void setTotalSendedTime(long sendedTime) {
|
synchronized (synObject2) {
|
totalSendedTime += sendedTime;
|
}
|
}
|
|
public static long getTotalSendedTime() {
|
synchronized (synObject2) {
|
return totalSendedTime;
|
}
|
}
|
|
/**
|
* 清空上次传输的数据
|
*/
|
public static void clearSendedData() {
|
totalReceivedSize = 0;
|
totalSendedSize = 0;
|
filePath = "";
|
fileLength = 0;
|
}
|
}
|