在执行以下代码后,复制的图片相当大,还不能打开,请哪位高手帮忙解释...
import java.io.*;
public class PictureCopyTest {
public static void main(String[] args) { FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream("D:\\test\\lee.jpg"); fos = new FileOutputStream("D:\\WallPaper\\lee.jpg"); byte[] b = new byte[512]; int n = 0;// 记录读取到内存的字节数 while ((n = fis.read()) != -1) { // 读取到-1的时候停止读取 fos.write(b); } } catch (Exception e) { e.printStackTrace(); } finally { try { fis.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); } } } }