import java.io.*;
class Test
{
public static void main(String[] agrs) throws Exception
{
//获取键盘输入对象
FileInputStream fis = new FileInputStream("d:\\1.jpg");
FileOutputStream fos =null;
byte[] by = new byte[1024*1024];
int line = 0;
while((line=fis.read(by))!=-1)
{
fos = new FileOutputStream("d:\\2.jpg");
fos.write(by,0,line);
fos.close();
}
fis.close();
}
}
这个可以。 |