CodePudding user response:
https://bbs.csdn.net/topics/397403076CodePudding user response:
/* ** @ param in the input stream
* @ param fileName to save to file such as/data/img/fun. PNG
*/
Public static void fun (InputStream in, String fileName) {
The File File=new File (fileName);
FileOutputStream FileOutputStream=null;
Try {
FileOutputStream=new fileOutputStream (file);
int i;
Byte [] TMP=new byte [1024].
While ((I=in the read (TMP))!=1) {
FileOutputStream. Write (TMP, 0, I);
}
FileOutputStream. Flush ();
} the catch (Exception e) {
e.printStackTrace();
} the finally {
Try {
If (fileOutputStream!=null) {
FileOutputStream. Close ();
}
If (in!=null) {
in.close();
}
{} the catch (IOException ignore)
}
}
}
CodePudding user response:
File stream cannot convert file?CodePudding user response:
Why back to the file stream, not the file location of the project