代码如下:
public class MyWork {
public static void main(String[] args) throws IOException {
FileInputStream input = new FileInputStream("input/Java的方向.png");
FileOutputStream output = new FileOutputStream("output/Java.png");
BufferedInputStream bInput = new BufferedInputStream(input);
BufferedOutputStream bOutput = new BufferedOutputStream(output);
byte[] b = new byte[1024];
int len;
while ((len = bInput.read(b)) != -1) {
bOutput.write(b,0,len);
}
bOutput.close();
bInput.close();
output.close();
input.close();
}
}