Im getting the file through this code, and "bos.write" saves it on my hard drive. Everything works well. Since I sent the file in a few seconds, I thought that I could store the file in memory instead of the HDD. Now how to do it?
File path = new File("C://anabella//test1.txt");
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(path));
int size = 1024;
int val = 0;
byte[] buffer = new byte[1024];
while (fileSize >0) {
val = in.read(buffer, 0, size);
bos.write(buffer, 0, val);
fileSize -= val;
if (fileSize < size)
size = (int) fileSize;
}
source
share