[求助]IO包如何读写图片文件?
JAVA的IO包如何读写图片文件?
最好能告诉我个实例,谢谢!
如果我下面写的错的不是特离谱,帮我改一下更好,谢谢!!
我这写完了全是乱码..
********************************************************************
import java.io.*;
class IOTest
{
public static void main(String[] args) throws IOException
{
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream("1.jpg")));
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("2.jpg")));
int i =in.read();
while(i!=-1)
{
i =in.read();
out.write(i);
}
out.flush();
in.close();
out.close();
}
}