FileInputStream fis = null;
DataInputStream dis = null;
FileOutputStream fos = null;
DataOutputStream dos = null;
try {
fis = new FileInputStream("F:\\IdeaProjects\\Java-Api\\file\\old.jpg");
dis = new DataInputStream(fis);
fos = new FileOutputStream("F:\\IdeaProjects\\Java-Api\\file\\new.jpg",true);
dos = new DataOutputStream(fos);
byte[] bytes = new byte[1024];
int temp;
while ((temp=dis.read(bytes))!=-1){
dos.write(temp);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
if (dos != null) {
dos.close();
}
if (fos != null) {
f
JavaAPI 高级特性 DataInputStream二进制输入流
最新推荐文章于 2024-01-09 09:26:00 发布