【code】文件移动到新的文件夹

来源:互联网 发布:2015年广告投放数据 编辑:程序博客网 时间:2024/05/21 06:46
    private static void moveToFloder(File pdfName,int intCopyType){        String newPath;        if(intCopyType == 0){                        // OKフォルダへコピーする            newPath = okFolderPath;        } else {                        // NGフォルダへコピーする            newPath = ngFolderPath;        }                try {            int bytesum = 0;            int byteread = 0;                        if (pdfName.exists()) {                InputStream inStream = new FileInputStream(pdfName);                FileOutputStream fs = new FileOutputStream(newPath);                                byte[] buffer = new byte[1444];                while ((byteread = inStream.read(buffer)) != -1) {                    bytesum += byteread;                    fs.write(buffer, 0, byteread);                }                                inStream.close();            }        } catch (Exception e) {            e.printStackTrace();        }    }    


原创粉丝点击