資源簡(jiǎn)介
代碼片段和文件信息
package?com.mingrisoft;
import?java.io.FileInputStream;
import?java.io.*;
import?javax.swing.Jframe;
import?javax.swing.ProgressMonitorInputStream;
public?class?ProgressMonitorTest?{
????
????public?void?useProgressMonitor(Jframe?frame?String?copyPath?String?newPath)?{
????????try?{
????????????File?file?=?new?File(copyPath);?//?根據(jù)要復(fù)制的文件創(chuàng)建File對(duì)象
????????????File?newFile?=?new?File(newPath);?//?根據(jù)復(fù)制后文件的保存地址創(chuàng)建File對(duì)象
????????????FileOutputStream?fop?=?new?FileOutputStream(newFile);?//?創(chuàng)建FileOutputStream對(duì)象
????????????InputStream?in?=?new?FileInputStream(file);
????????????//?讀取文件,如果總耗時(shí)超過2秒,將會(huì)自動(dòng)彈出一個(gè)進(jìn)度監(jiān)視窗口。
????????????ProgressMonitorInputStream?pm?=?new?ProgressMonitorInputStream(
????????????????????frame?“文件復(fù)制中,請(qǐng)稍后...“?in);
????????????int?c?=?0;
????????????byte[]?byt
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????????301??2011-05-23?19:43??.classpath
?????文件?????????379??2011-05-23?19:43??.project
?????目錄???????????0??2012-02-22?14:42??.settings\
?????文件?????????629??2011-05-23?19:43??.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2012-02-22?14:42??src\
?????目錄???????????0??2012-02-22?14:42??src\com\
?????目錄???????????0??2012-02-22?14:42??src\com\mingrisoft\
?????文件????????1215??2011-06-02?13:02??src\com\mingrisoft\ProgressMonitorTest.java
?????文件????????5230??2011-05-23?19:43??src\com\mingrisoft\UserMonitorfr
評(píng)論
共有 條評(píng)論