Hi Im trying to send data over the network using FileOutputStream. Whenever the FileOutputStream is created using the file linked it deleted all the data found as if it's replacing the old file with a new one.
Can someone please help? Here's the code.
File videoFile = new File (Current_video_file);
log.info(videoFile.toString());
InputStream is = null;
OutputStream outS = null;
try{
is = socket.getInputStream();
} catch (IOException e){
e.printStackTrace();
}
try{
outS = new FileOutputStream(videoFile);
} catch (IOException e){
e.printStackTrace();
}
byte [] videoLength = new byte [16*1024];
log.info("About to send");
int count;
while((count = is.read(videoLength)) > 0){
log.info("Sending Message");
outS.write(videoLength, 0, count);
}
log.info("Data Sent");
outS.close();
is.close();