此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【kunmingkunlun】截止到2008-07-22 09:46:35的历史汇总数据(不包括此帖):
发帖的总数量:48                       发帖的总分数:530                      每贴平均分数:11                       
回帖的总数量:62                       得分贴总数量:8                        回帖的得分率:12%                      
结贴的总数量:46                       结贴的总分数:490                      
无满意结贴数:24                       无满意结贴分:670                      
未结的帖子数:2                        未结的总分数:40                       
结贴的百分比:95.83 %               结分的百分比:92.45 %                  
无满意结贴率:52.17 %               无满意结分率:136.73%                  
值得尊敬

解决方案 »

  1.   


    /**
         * 拷贝一个目录或者文件到指定路径下
         * 
         * @param source
         * @param target
         */
        public static void copy(File source, File target)
        {
            File tarpath = new File(target, source.getName());
            if (source.isDirectory())
            {
                tarpath.mkdir();
                File[] dir = source.listFiles();
                for (int i = 0; i < dir.length; i++)
                {
                    copy(dir[i], tarpath);
                }
            }
            else
            {
                try
                {
                    InputStream is = new FileInputStream(source);
                    OutputStream os = new FileOutputStream(tarpath);
                    byte[] buf = new byte[1024];
                    int len = 0;
                    while ((len = is.read(buf)) != -1)
                    {
                        os.write(buf, 0, len);
                    }
                    is.close();
                    os.close();
                }
                catch (FileNotFoundException e)
                {
                    e.printStackTrace();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        }