带进度条的输入流

        try{
            byte[]b=new byte[2];
            File file1=new File("test1.txt");
            FileInputStream in1=new FileInputStream(file1);
            ProgressMonitorInputStream progress1=new ProgressMonitorInputStream(null,"huang",in1);
            ProgressMonitor p=progress1.getProgressMonitor();//get进度条
            for(;(progress1.read(b))!=-1;){//注意是progress1来读取
//            in1.read(b);
                String s=new String(b);
                System.out.print(s);
                Thread.sleep(10);
            }
        }
        catch(Exception e){}
    
原文地址:https://www.cnblogs.com/vhyc/p/6040619.html