zoukankan      html  css  js  c++  java
  • 复制图片

    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    
    public class Test {
    public static void main(String[] args) {
            
            
            
            
    
            
            FileInputStream fis = null;
            FileOutputStream fos = null;
            
            
            try {
                fis = new FileInputStream("C:/tupian/1.jpg");
                fos = new FileOutputStream("C:/tupian/2.jpg");
                
                int num = -1;
                try {
                    while((num = fis.read())!=-1) {
                        
                        fos.write(num);
                        
                        fos.flush();
                        
                    }
                    
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }finally {
                
                try {
                    if(fos!=null) {
                    fos.close();
                    }
                    try {
                        if(fis!=null) {
                        fis.close();
                        }
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                
            }
            
            
        }
    
        
    
    }
  • 相关阅读:
    数论
    平衡树
    矩阵儿快速幂
    分治
    考试
    考试
    匈牙利算法
    SPFA
    倍增
    MySql 技术内幕 (数据库组成和引擎)
  • 原文地址:https://www.cnblogs.com/hxtzzz/p/11299622.html
Copyright © 2011-2022 走看看