private static void savefile(InputStream is, String filename) {
int BUFFER_SIZE = 1024;
byte[] buf = new byte[BUFFER_SIZE];
int size = 0;
filepath = filepath + filename + ".txt";
filename=null;
File file = new File(filepath);
filepath=null;
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileOutputStream out = null;
BufferedInputStream bis = null;
try {
bis = new BufferedInputStream(is);
out = new FileOutputStream(file);
int i = 0;
// while ((i = is.read()) != -1) {
// out.write(i);
// }
while ((size = bis.read(buf)) != -1)
out.write(buf, 0, size);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
bis.close();
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
int BUFFER_SIZE = 1024;
byte[] buf = new byte[BUFFER_SIZE];
int size = 0;
filepath = filepath + filename + ".txt";
filename=null;
File file = new File(filepath);
filepath=null;
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileOutputStream out = null;
BufferedInputStream bis = null;
try {
bis = new BufferedInputStream(is);
out = new FileOutputStream(file);
int i = 0;
// while ((i = is.read()) != -1) {
// out.write(i);
// }
while ((size = bis.read(buf)) != -1)
out.write(buf, 0, size);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
bis.close();
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}