public static void main(String[] args) throws IOException {
A:FileInputStream fis = new FileInputStream("004.jpg");
FileOutputStream fos = new FileOutputStream("dest.jpg");
byte[] buffer = new byte[1024];
int len;
while ((len = fis.read(buffer)) != -1)
fos.write(buffer, 0, len);
fis.close();
fos.close();
}
B:FileInputStream fis = new FileInputStream("004.jpg");
FileOutputStream fos = new FileOutputStream("dest.jpg");
int b;
while((b=fis.read)!=-1)
fos.write(b);
|