• Java基础之IO流,通过字节流缓冲区进行媒体文件的复制操作


    import java.io.*;

    class BufferedCopyFileDemo
    {
        public static void main(String[] args)throws IOException
        {
            BufferedInputStream bis = null;
            BufferedOutputStream bos = null;
        
            try
            {
                bis = new BufferedInputStream(new FileInputStream(new File("001.avi")));
                bos = new BufferedOutputStream(new FileOutputStream(new File("001-1.avi")));
                
                int ch = 0;
                while((ch=bis.read())!=-1)
                {
                    bos.write(ch);
                }            
            }
            catch(IOException e)
            {
                System.err.println(e.getMessage());
            }
            finally
            {
                try            
                {
                    if(null!=bis)bis.close();
                    if(null!=bos)bos.close();
                }
                catch(IOException e)
                {
                    System.err.println(e.getMessage());
                }
            }
        }
    }
  • 相关阅读:
    The usage of Markdown---杂谈:缩进/换行/分割线/注释/文字颜色
    insert into,insert into select,replace into,replace into select,insert ignore into,on duplicate key update
    mysql使用指南
    openssl使用
    黑名单
    zsh+iTerm2+ powerline+oh-my-zsh+ agnoster
    mac安装brew软件管理工具
    mysql性能优化
    numactl
    vscode
  • 原文地址:https://www.cnblogs.com/cxmsky/p/2886936.html
Copyright © 2020-2023  润新知