62,614
社区成员
发帖
与我相关
我的任务
分享
public void run()
{
BufferedInputStream bis;
BufferedOutputStream bos;
byte b[];
JFileChooser fc = new JFileChooser();
int rt = fc.showSaveDialog(null);
fc.setFileSelectionMode(1);
if(rt != 0)
break MISSING_BLOCK_LABEL_369;/////为什么这里会有这段东西的~?
filepath = fc.getSelectedFile();
bis = null;
bos = null;
b = new byte[0x20000];
int num = 0;
try
{
bis = new BufferedInputStream(sReceive.getInputStream());
bos = new BufferedOutputStream(new FileOutputStream(filepath));
long receiveData = 0L;
long preTime = (new Date()).getTime();
long curTime = preTime;
long amount = 0L;
int num;
while((num = bis.read(b)) != -1)
{
bos.write(b, 0, num);
receiveData += num;
amount += num;
curTime = (new Date()).getTime();
pb.setValue((int)((receiveData / filelength) * 100L));
if(curTime - preTime > 500L)
{
lSendRate.setText((new StringBuilder("\u4F20\u8F93\u901F\u7387\u4E3A")).append(getFilelength((amount * 1000L) / (curTime - preTime))).append("/\u79D2").toString());
preTime = curTime;
amount = 0L;
}
}
lShowSendMessage.setText("\u6587\u4EF6\u63A5\u53D7\u5B8C\u6BD5");
break MISSING_BLOCK_LABEL_334;
}
catch(IOException e)
{
e.printStackTrace();
}
try
{
if(bis != null)
bis.close();
if(bos != null)
bos.close();
sReceive.close();
}
catch(IOException e)
{
e.printStackTrace();
}
break MISSING_BLOCK_LABEL_369;
Exception exception;
exception;
try
{
if(bis != null)
bis.close();
if(bos != null)
bos.close();
sReceive.close();
}
catch(IOException e)
{
e.printStackTrace();
}
throw exception;
try
{
if(bis != null)
bis.close();
if(bos != null)
bos.close();
sReceive.close();
}
catch(IOException e)
{
e.printStackTrace();
}
}