-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSaveAutoFormFile.java
More file actions
37 lines (35 loc) · 945 Bytes
/
SaveAutoFormFile.java
File metadata and controls
37 lines (35 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.andot.ADFile.util;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class SaveAutoFormFile {
/**
* 自定义表单存放方法
* @author andot
* @throws IOException
* @date 2017-9-12 16:24:45
*
* */
public static boolean saveFile(InputStream stream,String path,String savefile) throws IOException{
FileOutputStream fs=new FileOutputStream( path + savefile);
System.out.println("自定义表单存放路径:------------"+path + savefile);
byte[] buffer =new byte[1024*1024];
int bytesum = 0;
int byteread = 0;
try {
while ((byteread=stream.read(buffer))!=-1)
{
bytesum+=byteread;
fs.write(buffer,0,byteread);
fs.flush();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
fs.close();
stream.close();
return true;
}
}