@toc

File 转 InputStream

InputStream in = new FileInputStream(file);

InputStream 转 File

public void inputstreamtofile(InputStream ins,File file) {
   OutputStream os = new FileOutputStream(file);
   int bytesRead = 0;
   byte[] buffer = new byte[1024];
   while ((bytesRead = ins.read(buffer, 0, 1024)) != -1) {
     os.write(buffer, 0, bytesRead);
   }
   os.close();
   ins.close();
}