1,读取文件将文件转换为二进制流


1 InputStream in = new FileInputStream("C:/test.png"); 2 byte[] photo = new byte[in.available()]; 3 in.read(photo); 4 in.close();
2,写文件


1 OutputStream out = new FileOutputStream("c:/copy.png"); 2 out.write(u.getPhoto()); 3 out.close();