zoukankan      html  css  js  c++  java
  • java 字节流

    package com.jack.io;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    
    public class main {
        public static void main(String[] args) throws Exception {
            //文件的复制
            long s = System.currentTimeMillis();
            File file1 = new File("D:\迅雷下载\公牛犹斗.1080p.HD中字.mp4");
            File file2 = new File("D:\迅雷下载\公牛犹斗.1080p.HD中字2.mp4");
    
            FileInputStream fileInputStream = new FileInputStream(file1);
            FileOutputStream fileOutputStream = new FileOutputStream(file2, true);
            byte[] bs = new byte[1024*1024];

    while ((fileInputStream.read(bs)) != -1) { fileOutputStream.write(bs); } fileInputStream.close(); fileOutputStream.close(); long e = System.currentTimeMillis(); System.out.println("复制文件,耗时毫秒:" + (e - s)); } }

  • 相关阅读:
    软件原则
    Optional
    雪花算法原理
    AOP
    trycatchfinally
    lambda表达式
    BeanUtils属性转换工具
    @Transactional 失效
    用户线程&&守护线程
    卡顿问题
  • 原文地址:https://www.cnblogs.com/ligenyun/p/12643419.html
Copyright © 2011-2022 走看看