欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
文件上傳流式處理commons
import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import org.apache.commons.fileupload.util.Streams;import org.apache.commons.io.IOUtils;import org.springframework.web.multipart.MultipartFile;public class UploadFileUtil {    /**     * 使用相同的名稱(chēng)     * @param file     * @param filePath     * @return     */    public static String handleFileUpload(MultipartFile file,String filePath){        try {            if(!file.isEmpty()){                String name=file.getOriginalFilename();                InputStream inpustream=file.getInputStream();                FileOutputStream fos = new FileOutputStream(filePath+File.separator+name);                Streams.copy(inpustream, fos, true);                }else{                return "can not upload this file,because it is empty!";            }        } catch (IOException e) {            return "failed to upload this file,because Stream interrupt unexpectedly";        }        return "upload file sucess";    }        /**     * 重命名文件,包含后綴     * @param file     * @param filePath     * @param fileName     * @return     */    public static String handleFileUpload(MultipartFile file,String filePath,String fileName){        try {            if(!file.isEmpty()){                InputStream inpustream=file.getInputStream();                FileOutputStream fos = new FileOutputStream(filePath+File.separator+fileName);                Streams.copy(inpustream, fos, true);                }else{                return "can not upload this file,because it is empty!";            }        } catch (IOException e) {            return "failed to upload this file,because Stream interrupt unexpectedly";        }        return "upload file sucess";    }        /**     *Copy bytes from a large (over 2GB) file with same filename     * @param file     * @param filePath     * @param fileName     * @return     */        public static String handleLargeFileUpload(MultipartFile file,String filePath){        try {            if(!file.isEmpty()){                String name=file.getOriginalFilename();                InputStream inpustream=file.getInputStream();                FileOutputStream fos = new FileOutputStream(filePath+File.separator+name);                IOUtils.copyLarge(inpustream, fos);                    if(inpustream!=null){                    inpustream.close();                }                if(fos!=null){                    fos.close();                }            }else{                return "can not upload this file,because it is empty!";            }        } catch (IOException e) {            return "failed to upload this file,because Stream interrupt unexpectedly";        }        return "upload file sucess";    }        /**     *Copy bytes from a large (over 2GB) file with rename file     * @param file     * @param filePath     * @param fileName     * @return     */        public static String handleLargeFileUpload(MultipartFile file,String filePath,String fileName){        try {            if(!file.isEmpty()){                InputStream inpustream=file.getInputStream();                FileOutputStream fos = new FileOutputStream(filePath+File.separator+fileName);                IOUtils.copyLarge(inpustream, fos);                    if(inpustream!=null){                    inpustream.close();                }                if(fos!=null){                    fos.close();                }            }else{                return "can not upload this file,because it is empty!";            }        } catch (IOException e) {            return "failed to upload this file,because Stream interrupt unexpectedly";        }        return "upload file sucess";    }}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
java上傳文件跟批量下載文件
分享 commons io 工具類(lèi) 代碼
java中文件操作大全
java 從網(wǎng)絡(luò )Url中下載文件
16. 文件的保存與讀取
android開(kāi)發(fā)中的文件操作
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久