五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

分割的文件進行合并的代碼

2020-04-05 16:39 作者:小垃圾kiki  | 我要投稿
package cn.jd.io;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Copy {
?? ?public static void main(String[] args) {
?? ??? ?long t1=System.currentTimeMillis();? ?
?? ??? ?copy("如何實現(xiàn)手機和電腦的藍牙傳輸.mp4","如何實現(xiàn)手機和電腦的藍牙傳輸2.mp4");
?? ??? ?long t2=System.currentTimeMillis();//好爽就是這么塊
?? ??? ?System.out.println(t2-t1);
?? ?}

?? ?public static void copy(String srcPath, String destPath) {
?? ??? ?// 確定源
?? ??? ?//現(xiàn)在是沒有使用緩沖流
?? ??? ?File src = new File(srcPath);// 讀取的文件,使用輸入流 因為是從文件到程序
?? ??? ?File src1 = new File(destPath);// 寫入文件,輸出流,從程序到文件
?? ??? ?// 確定流
?? ??? ?//這里我是對字節(jié)流的釋放用了另一種方法
?? ??? ?try(InputStream? is=new BufferedInputStream(new FileInputStream(src));
?? ??? ??? ??? ?OutputStream? os=new BufferedOutputStream(new FileOutputStream(src1));) {
?? ??? ??? ?
?? ??? ??? ?
?? ??? ??? ?byte[] flush = new byte[3];
//?? ??? ??? ??? ?System.out.println(flush.toString());???? 這里我們只是定義了,里面還沒有內(nèi)容
?? ??? ??? ?int len = -1;
?? ??? ??? ?// 確定方法
?? ??? ??? ?while ((len = is.read(flush)) != -1) { // 通過is.read讀取字節(jié)數(shù)組的長度
//?? ??? ??? ??? ??? ?System.out.println(len);
//?? ??? ??? ??? ??? ?System.out.println(flush.toString());?? //這里我不知道怎么輸出字符了
?? ??? ??? ??? ?os.write(flush, 0, len); // 將flush里面的字節(jié)寫入到文件 ,這里要輸入實際的長度
?? ??? ??? ?}
?? ??? ??? ?os.flush(); // 刷新緩沖流

?? ??? ?} catch (FileNotFoundException e) {

?? ??? ??? ?e.printStackTrace();
?? ??? ?} catch (IOException e) {
?? ??? ??? ?// TODO Auto-generated catch block
?? ??? ??? ?e.printStackTrace();
?? ??? ?}
?? ??? ?

?? ?}
}

分割的文件進行合并的代碼的評論 (共 條)

分享到微博請遵守國家法律
金堂县| 盐城市| 门头沟区| 北海市| 邵东县| 通海县| 福州市| 鹤庆县| 宝丰县| 留坝县| 突泉县| 稻城县| 东方市| 仁化县| 北辰区| 千阳县| 清丰县| 蒲江县| 庆安县| SHOW| 阿瓦提县| 休宁县| 鲁甸县| 芒康县| 彝良县| 通辽市| 密山市| 黎城县| 增城市| 宝鸡市| 河东区| 和平区| 石景山区| 湖口县| 博湖县| 原阳县| 嵩明县| 辉县市| 岚皋县| 娄烦县| 富顺县|